Java 8 Optional as a Monad
Lately there has been lot of discussions around functional programming and object oriented programming and their differences. A few functional programming constructs had also been introduced in Java 8 release a couple of years back. Since then I have been exploring functional programming and I have realized that using a mix of both functional and object oriented styles in my code has enabled me to write code that is both easy to read and easy to explain.
REST Error Responses in Spring Boot
The format of error responses from REST web services has always been a topic of grey area for me. According to me, whatever format you choose, it should give enough information to the clients, consuming the REST web services, so that the clients can handle the error situations gracefully. Spring Boot takes an opinionated view on this. In this article I will show what is Spring Boot’s way formatting error responses.
Writing Comparators - The Java 8 Way
Java 8 introduced a few default methods and static factory methods on the Comparator interface using which developers can write Comparators in a declarative way. The Comparator interface combines the principles from Builder Pattern, Factory Method Pattern, Decorator Pattern and Functional Programming to come up with a very expressive API.
RxJava - Part 3 - Multithreading
RxJava makes it easy to write asynchronous and concurrent applications. To be able to do that you will have to write programs that get executed on multiple threads. In this article I will show how RxJava helps in writing multithreaded programs using Scheduler and Observable’s subscribeOn() and observeOn() methods.