Java 8 Comparator
On java 8 Comparator interface there are new default methods using which compare objects in declarative way.
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 Java 8 Reduce
function
Java 8 convert List to Arrays
Java 8 convert List to Set
How java 8 lambda lazy evaluation helps in clean logging
code.
In Java 8 we can use Files.lines
to read file into stream and do manipulations.
Let’s say we want to count the number of unique words in the file.
Stream can be created from arrays using Arrays.stream
static method. For example having an array of integers we can convert into IntStream:
Introduction to Java 8 streams
and functional programming.
Stream API provides facilities to check weather elements in a certain set of data satisfy some conditions. This is done by allMatch, anyMatch, noneMatch
methods of stream.