Top "Java-stream" questions

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

How to ensure order of processing in java8 streams?

I want to process lists inside an XML java object. I have to ensure processing all elements in order I …

java java-8 java-stream
Get last element of Stream/List in a one-liner

How can I get the last element of a stream or list in the following code? Where data.careas is …

java list java-8 java-stream
Can Java 8 Streams operate on an item in a collection, and then remove it?

Like just about everyone, I'm still learning the intricacies (and loving them) of the new Java 8 Streams API. I have …

java collections java-8 filtering java-stream
Java 8 Streams - collect vs reduce

When would you use collect() vs reduce()? Does anyone have good, concrete examples of when it's definitely better to go …

java java-8 java-stream
Java 8: performance of Streams vs Collections

I'm new to Java 8. I still don't know the API in depth, but I've made a small informal benchmark to …

java performance collections java-8 java-stream
'Optional.get()' without 'isPresent()' check

I have the following search code in Java: return getTableViewController().getMe().getColumns().stream().filter($->Database.equalsColumnName($.getId(), columnId)).…

java java-8 java-stream optional
how to find maximum value from a Integer using stream in java 8?

I have a list of Integer list and from the list.stream() I want the maximum value. What is the …

java-8 java-stream
How to make a new list with a property of an object which is in another list

Imagine that I have a list of certain objects: List<Student> And I need to generate another list …

java list collections java-stream guava
Why does findFirst() throw a NullPointerException if the first element it finds is null?

Why does this throw a java.lang.NullPointerException? List<String> strings = new ArrayList<>(); strings.add(null); …

java java-8 java-stream optional
Java 8: Preferred way to count iterations of a lambda?

I face the same problem often. I need to count the runs of a lambda for use outside the lambda. …

java lambda java-8 java-stream