Prior to Sealed Classes feature there were two ways a developer could prevent a class to be extended: by declaring the class as final where no one can extend this class. 2. by making the class package private where no… Read More ›
Java
Java 16 – Records and Constructor
In my previous post, I introduced you to the new construct called Records which was introduced in Java 16. In this post, I will go a bit deeper into how you can override the default constructor of a record which… Read More ›
Java 16 – Records
We all, Java programmers, have complained whenever we were forced to create a class or use maps just to hold some data whilst other newer languages provided some out-of-the-box data structure for the same. Our problem has been addressed by… Read More ›
Difference between Function.andThen and Function.compose
There are two different ways to mix functions in Java: using andThen using compose It is important to understand the difference between the two. andThen: function1.andThen(function2) will first apply function1 to the input and the result of this will be… Read More ›
Sample Logback Configuration for Spring Boot Profile Based Logging
We would want different logging configurations for different profiles in Spring Boot, like in local running we would just want console logging and for production, we would want file logging with support for rolling the log files daily. I came… Read More ›
Getting to know about java.nio.file.Path – 2
In Part 1 of this, we looked at most of the APIs in the java.nio.file.Path class. In this article, we will look at the remaining APIs. Using register() This API allows us to register an implementation of java.nio.file.WatchService interface which… Read More ›
Getting to know about java.nio.file.Path – 1
Introduction The last few released of Java namely Java 7, Java 8 and the upcoming Java 9 have quite a lot of features which makes the life of Java developers easier. (I know Java 9 will make it tougher, but… Read More ›
Gotcha: Migrating from Spring Security 3.2.x to Spring Security 4.x
Here is a simple gotcha to keep in mind while migrating to newer Spring Security version 4.x from Spring Security 3.2.x What’s the problem? The Spring security configuration expressions hasRole(‘role_name’) and hasAuthority(‘role_name’) are no longer the same. The catch is:… Read More ›
Deep dive into Optional class API in Java 8
We all as Java programmers been through the situation where in we invoke a method to get some value and then instead of directly invoking some methods on the return value, we first have to check that the return value… Read More ›
Book review: Core Java, Volume II–Advanced Features (9th Edition)
http://www.flipkart.com/affiliate/displayWidget?affrid=WRID-136978840229968837 I always liked the approach Cay S. Horstmann takes in the examples in his Core Java books. He tries to follow good practices in all his examples which includes better naming convention, documentation and comments, identifying right classes. This… Read More ›