Java 8 Stream.iterate examples
In Java 8, we can use Stream.iterate to create stream values on demand, so called infinite stream. The stream.iterate was enhanced in Java 9. It supports a predicate (condition) as…
Favourite tutorials for developers
In Java 8, we can use Stream.iterate to create stream values on demand, so called infinite stream. The stream.iterate was enhanced in Java 9. It supports a predicate (condition) as…
The following 3 Java examples will print a list of all the prime numbers up to 1,000: 1 - Java 8 Stream and BigInteger, 2 - Plain old Java ,…
Few Java 8 examples to execute streams in parallel: BaseStream.parallel() or Collection.parallelStream() . We can check to see that by default, parallel streams use `ForkJoinPool`. We can use Parallel streams…
In Java 8, UnaryOperator is a functional interface and it extends Function. The UnaryOperator takes one argument, and returns a result of the same type of its arguments. The Function…
In Java 8, BinaryOperator is a functional interface and it extends BiFunction. The BinaryOperator takes two arguments of the same type and returns a result of the same type of…
In this article, we will show you a few StringJoiner examples to join String. Join String by a delimiter and starting with a supplied prefix and ending with a supplied…
In Java, we can use String.join(",", list) to join a List String with commas. We also can use Stream Collectors.joining or even in old days we create a custom method…
Jackson provide writeValue() and readValue() methods to convert Java objects to / from JSON. mapper.writeValue – Java Objects to JSON. mapper.readValue – JSON to Java Objects.
In this tutorial, we will show you how to use Jackson 2.x to convert Java objects to / from a JSON: writeValue(...) – Java Objects to JSON , readValue(...) –…
In Java 8, the Stream.reduce() combine elements of a stream and produces a single value, with 2 arguments: 1 - identity is default or initial value, and 2 - BinaryOperator…