Category: Stream

Reading the response of running a process 0

Reading the response of running a process

We all know we can use Java’s Process API to run any executable. But sometimes these executios might return some response or perhaps throw some exceptions. How to read them? So here is simple...

Converting Set to List using Streams 0

Converting Set to List using Streams

Stream APIs were added in Java 8. You can read more about streams here : Java 8 Streams With single line of code we can convert a set into a list. Other wise we...

Java 8 Stream – Does processing order of stream operations matter? 0

Java 8 Stream – Does processing order of stream operations matter?

Lets directly jump to a stream example 1 2 3 4 5 6 Stream.of("d2", "a2", "b1", "b3", "c") .filter(s -> { System.out.println("filter: " + s); return true; }) .forEach(s -> System.out.println("forEach: " + s));Stream.of("d2",...

Java 8 Stream – How to run them in parallel 0

Java 8 Stream – How to run them in parallel

Streams can be executed in parallel to increase runtime performance on large amount of input elements. Parallel streams use a common ForkJoinPool available via the static ForkJoinPool.commonPool() method. The size of the underlying thread-pool...

Java 8 Stream – All You Want To Know 0

Java 8 Stream – All You Want To Know

Stream is a new abstract layer introduced in Java 8. Consider this SQL query : select min(salary) emd_id,emp_name FROM employee This query will return maximum salaried employee’s details. Can we write similar logic in...