Tag: Lambda

Java 8 Stream.reduce() method code examples

We can perform reduction operation on elements of the stream by using Stream.reduce() method that returns an Optional describing the reduced object or the the reduced value itself. In this post, we will see few simple example of Stream.reduce() method.

Reverse a Sequential Stream in Java

In this post, we will discuss how to reverse a sequential Stream in Java. Since streams don’t store any elements, an intermediate collection is used to create a new stream which iterates elements of the specified stream in reverse order.