Java 9 CompletableFuture API improvements – delayedExecutor
Java 9 introduces a couple of improvements in CompletableFuture API. Today let’s take a look at new delayedExecutor
static method.
Java 9 introduces a couple of improvements in CompletableFuture API. Today let’s take a look at new delayedExecutor
static method.
One of the improvements in Java 9 CompletableFuture is the orTimeout
method:
CompletableFuture orTimeout(long timeout, TimeUnit unit)
Diamond operator ‘<>’ was introduced in Java 7 to make instantiation of generic classes easier.
In Java 9 try-with-resources statement has been improved. Now if you already have final or effectively final resource you can use it in try-with-resources statement without need to declare a dummy variable.
Before Java 9 we could have underscore [ _ ] as a one character identifier.
In Java SE 9 interfaces can have private and private static methods.
Java 9 enhances the java collections and provides static methods for creating small immutable collection instances.
On java 8 Comparator interface there are new default methods using which compare objects in declarative way.
Suppose we have a List of strings and want to group them by length.
We can use Collectors.groupingBy()
for this task.
Understanding encoding in details and various encoding mechanisms.