Top "Java-stream" questions

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

Why does Stream.allMatch() return true for an empty stream?

My colleague and I had a bug that was due to our assumption that an empty stream calling allMatch() would …

java lambda java-8 java-stream
java 8 how to get distinct list on more than one property

How can one get the distinct (distinct based on two property) list from a list of objects. for example let …

java lambda java-8 java-stream distinct-values
In Java 8, is there a ByteStream class?

Java 8 provides Stream<T> specializations for double, int and long: DoubleStream, IntStream and LongStream respectively. However, I could …

java java-8 byte java-stream boxing
Is there an elegant way to process a stream in chunks?

My exact scenario is inserting data to database in batches, so I want to accumulate DOM objects then every 1000, flush …

java java-8 java-stream chunking
Java 8 is not maintaining the order while grouping

I m using Java 8 for grouping by data. But results obtained are not in order formed. Map<GroupingKey, List&…

java-8 grouping java-stream collect
How can I collect a Java 8 stream into a Guava ImmutableCollection?

I would like to do the following: List<Integer> list = IntStream.range(0, 7).collect(Collectors.toList()); but in a …

java-8 guava java-stream
Iterator versus Stream of Java 8

To take advantage of the wide range of query methods included in java.util.stream of Jdk 8 I am attempted …

java java-8 domain-driven-design java-stream domain-model
Java 8 Stream API toMap converting to TreeMap

public class Message { private int id; private User sender; private User receiver; private String text; private Date senddate; .. } I have …

java lambda java-8 java-stream collectors
Java 8 convert String of ints to List<Integer>

I have a String: String ints = "1, 2, 3"; I would like to convert it to a list of ints: List<Integer&…

java java-8 java-stream collectors
Java 8 stream api how to collect List to Object

I have two simple class ImageEntity and ImageList how to collect result list ImageEntity to ImageList ? List<File> …

lambda java-8 java-stream collect collectors