Top "Java-stream" questions

Use this tag for questions related to the use of the Stream API.

Create Java 8 Stream from ArrayNode

Is it possible to create stream from com.fasterxml.jackson.databind.node.ArrayNode? I tried: ArrayNode files = (ArrayNode) json.get("…

jackson java-8 java-stream fasterxml
collecting from parallel stream in java 8

I want to take an input and apply parallel stream on that, then I want output as list. Input could …

java java-8 java-stream java.util.concurrent
Why Comparator.comparing doesn't work with String::toLowerCase method reference?

I am trying to sort an array of Strings by reverse order (ignoring case), without modifying it, and just printing …

java comparator java-8 java-stream method-reference
How to apply Filtering on groupBy in java streams

How do you group first and then apply filtering using Java streams? Example: Consider this Employee class: I want to …

java java-8 java-stream java-9 collectors
How to perform Stream functions on an Iterable?

In Java 8, the Stream class does not have any method to wrap a an Iterable. Instead, I am obtaining the …

java java-8 java-stream iterable spliterator
Java 8 lambdas grouping by multiple fields

I have a list of pojos that I want to perform some grouping on. Something like: public class Pojo { private …

java java-8 java-stream collectors
Recursively Flatten values of nested maps in Java 8

Given a Map<String, Object>, where the values are either a String or another Map<String, Object&…

java java-8 java-stream flatten
Grouping by object value, counting and then setting group key by maximum object attribute

I have managed to write a solution using Java 8 Streams API that first groups a list of object Route by …

java java-8 grouping java-stream
Java 8 Stream IllegalStateException: Stream has already been operated on or closed

I'm trying to generate Order instances using the Stream API. I have a factory function that creates the order, and …

java java-8 java-stream data-generation
Counting elements of a Stream

I want to count the different elements of a stream and am wondering why Stream<String> stream = Stream.…

java count java-8 java-stream collectors