Book Review: Atomic Habits by James Clear

I recently finished reading the amazing book Atomic Habits by James Clear. This book is about tips and techniques which one can adopt to build habits that last. The book is centered on how one can make small changes in life by inculcating good habits and removing bad habits which when repeated and built upon … Read more

Java 16 – Pattern matching for instanceof

We all have used instanceof check with a subsequent cast to the desired type and in this process, we are doing two operations: validating whether the object we have is of the desired type using instanceof when the validation is true then we cast the object to the desired type and proceed with the operations. … Read more

Using ROWNUM to paginate the data in Oracle

In one of my previous posts, I showed you how to use ROWNUM with ORDER BY clause. Building on that in this post I will show you how you can paginate your results using ROWNUM in Oracle DB and how you should not paginate your data. Suppose I have a table with the following structure: … Read more

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 is different from the no-arg default constructor of a class. Default constructor in a record … 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 introducing “Records” as part of the JEP 395 in Java 16. This construct is introduced … 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 passed to the function2. compose: function1.compose(function2) will first apply the input to the function2 and … Read more

Book Review: Do Epic Shit

“Do Epic Shit” is a self-help book by Ankur Warikoo which was released on December 2021. This is an amazing book. Very easy to read. The author has been honest and has shared his experiences so that anyone treading the same path shouldn’t repeat the mistakes. Everything that the author says makes a lot of … Read more

Different ways of declaration and initialization of arrays in Java

The below code shows the different ways one can declare and initialize an Array in Java: Line 5: Declaration of array along with initialization of its values. Here it is not required to pass the size of the array. Line 8-9: Declaration of array by providing its size. The array will be initialized with 0 … Read more

Testing the File Upload API in Spring Boot

In one of my previous post, I had created an API to upload file. In this post I will write a JUnit test to test the API. We will test the complete flow right from uploading till it is copied to the file system and then we will also see how to mock the FileService … Read more

%d bloggers like this: