Top "Java-stream" questions

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

Java 8 List<V> into Map<K, V>

I want to translate a List of objects into a Map using Java 8's streams and lambdas. This is how …

java lambda java-8 java-stream
How to convert a Java 8 Stream to an Array?

What is the easiest/shortest way to convert a Java 8 Stream into an array?

java arrays java-8 java-stream
Find first element by predicate

I've just started playing with Java 8 lambdas and I'm trying to implement some of the things that I'm used to …

java java-8 java-stream
What's the difference between map() and flatMap() methods in Java 8?

In Java 8, what's the difference between Stream.map() and Stream.flatMap() methods?

java java-8 java-stream
How to sum a list of integers with java streams?

I want to sum a list of integers. It works as follows, but the syntax does not feel right. Could …

java java-8 java-stream
Java 8 Iterable.forEach() vs foreach loop

Which of the following is better practice in Java 8? Java 8: joins.forEach(join -> mIrc.join(mSession, join)); Java 7: …

java for-loop java-8 java-stream
Using Java 8 to convert a list of objects into a string obtained from the toString() method

There are a lot of useful new things in Java 8. E.g., I can iterate with a stream over a …

java java-8 java-stream
Retrieving a List from a java.util.stream.Stream in Java 8

I was playing around with Java 8 lambdas to easily filter collections. But I did not find a concise way to …

collections lambda java-8 java-stream
Java 8 Distinct by property

In Java 8 how can I filter a collection using the Stream API by checking the distinctness of a property of …

java collections java-8 java-stream distinct-values
How to use a Java8 lambda to sort a stream in reverse order?

I'm using java lambda to sort a list. how can I sort it in a reverse way? I saw this …

java lambda java-8 java-stream