Top "Java-stream" questions

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

Collectors.toSet() and HashSet

Take the following line of sample code: Set<String> someSet = someColletion.stream().map(p -> p.toString()).…

java java-8 java-stream collectors
Jenkins pipeline script to copy or move file to another destination

I am preparing a Jenkins pipeline script in Groovy language. I would like to move all files and folders to …

java-stream jenkins-pipeline jenkins-groovy
Why does Stream<T> not implement Iterable<T>?

In Java 8 we have the class Stream<T>, which curiously have a method Iterator<T> iterator() …

java java-8 java-stream iterable
What Java 8 Stream.collect equivalents are available in the standard Kotlin library?

In Java 8, there is Stream.collect which allows aggregations on collections. In Kotlin, this does not exist in the same …

java kotlin collections java-8 java-stream
Difference between findAny() and findFirst() in Java 8

I am little confused between Stream#findAny() and Stream#findFirst() of the Stream API in Java 8. What I understood is …

java java-8 java-stream
Java 8 Collectors.toMap SortedMap

I'm using Java 8 lambdas and want to use Collectors toMap to return a SortedMap. The best I can come up …

java lambda java-8 java-stream collectors
Is it possible to use the Java 8 Stream API on Android API < 24?

I've read this post here. But still I cannot run code containing Java 8 Stream API features like the following on …

java android java-8 java-stream
Collectors.groupingBy doesn't accept null keys

In Java 8, this works: Stream<Class> stream = Stream.of(ArrayList.class); HashMap<Class, List<Class>&…

java hashmap java-8 java-stream collectors
How do I turn a Java Enumeration into a Stream?

I have a third party library that gives me an Enumeration<String>. I want to work with that …

java java-8 java-stream
Sorting using Comparator Interface and java 8 Streams

Parent is a class which is inherited by Child. which is inherited by GrandChild. Each class contains List of the …

java sorting java-8 comparator java-stream