Top "Java-stream" questions

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

Adding up BigDecimals using Streams

I have a collection of BigDecimals (in this example, a LinkedList) that I would like to add together. Is it …

java bigdecimal java-8 java-stream
Java 8 lambdas, Function.identity() or t->t

I have a question regarding the usage of the Function.identity() method. Imagine the following code: Arrays.asList("a", "b", "…

java lambda java-8 java-stream
Fetch first element which matches criteria

How to get first element that matches a criteria in a stream? I've tried this but doesn't work this.stops.…

java java-8 java-stream
In Java 8 how do I transform a Map<K,V> to another Map<K,V> using a lambda?

I've just started looking at Java 8 and to try out lambdas I thought I'd try to rewrite a very simple …

java map lambda java-8 java-stream
Modifying Objects within stream in Java8 while iterating

In Java8 streams, am I allowed to modify/update objects within? For eg. List<User> users: users.stream().…

java java-8 java-stream
Convert Iterable to Stream using Java 8 JDK

I have an interface which returns java.lang.Iterable<T>. I would like to manipulate that result using …

java java-8 java-stream iterable
Java 8 Stream API to find Unique Object matching a property value

Find the object matching with a Property value from a Collection using Java 8 Stream. List<Person> objects = new …

java filter java-8 java-stream
How should we manage jdk8 stream for null values

Hello fellow Java developers, I know the subject may be a bit in advance as the JDK8 is not yet …

java null java-8 java-stream
Java 8 Streams FlatMap method example

I have been checking the upcoming Java update, namely: Java 8 or JDK 8. Yes, I am impatient, there's a lot of …

java java-8 java-stream flatmap
How can I throw CHECKED exceptions from inside Java 8 streams?

How can I throw CHECKED exceptions from inside Java 8 streams/lambdas? In other words, I want to make code like …

java lambda java-8 java-stream checked-exceptions