We all have used Recursion few to many times in our programming journey. Recursion is an approach/strategy of solving a problem such that the solution depends on the smaller/reduced version of the same problem. Let us consider calculating the Factorial of a number. Factorial Output : The above piece of code uses 2 approaches to […]
Java 16 : Records
Java Classes formed the basis of whatever Object Oriented Programming we have been doing prior to the introduction of Functional Programming with Java 8 which gave a new perspective to how we program in Java. Java has come a long way in terms of the features that it offers as well as coping up with […]
Java 16 : Pattern Matching for instanceof Operator
We have been using the instanceof operator since ages to determine whether a particular Object is of a particular type. Java came up with the concept of Pattern Matching for instanceof as a proposal/preview in Java 14, which was put for a 2nd preview in Java 15 and finally made available as a feature in […]
Java 12 : The Teeing Collector
Taking the comfort of streams ahead Java 12 has added a new collector feature that merges the results of 2 collectors. Let’s say for an example that you wanted to extract 2 different results from the very same Stream. We would have to create a separate stream and then extract those results individually and move […]
ExecutorService in Java
Writing multithreaded code and expecting it to work as expected has been a moment of joy as well as a nightmare both at the same time in the earlier releases of Java. Prior to Java 5, the way we used to create Threads were : Extend the Thread class Implement the Runnable interface Let us […]