Use this tag for questions related to the use of the Stream API.
In order to practise the Java 8 streams I tried converting the following nested loop to the Java 8 stream API. It …
java performance java-8 nested-loops java-streamI expected to be able to use Stream::flatMap like this public static List<String> duplicate(String s) { …
java java-8 java-stream flatmapI have a need in a block of code to consume 'n' items from a stream then finish, in essence: …
java java-8 java-stream consumerReading up a bit on Java 8, I got to this blog post explaining a bit about streams and reduction of …
java java-8 java-stream short-circuitingCan I convert the following code using method reference? List<Text> childrenToRemove = new ArrayList<>(); group.getChildren().…
java java-8 java-stream method-referenceSuppose to have a class Obj class Obj{ int field; } and that you have a list of Obj instances, i.…
java java-8 minimum java-streamI thought I was getting pretty good at Java 8 streams, but then... I have a Foo interface: public interface Foo { …
java key java-stream collectI have the below code which is bit ugly for multiple null checks. String s = null; if (str1 != null) { s = …
java lambda java-8 java-stream optionalI have the following class. class Person { String name; LocalDate birthday; Sex gender; String emailAddress; public int getAge() { return birthday.…
java lambda java-8 java-stream collectorsFor the Collectors.groupingBy() that returns Map<K,List<T>> is it implied that the List&…
java java-8 java-stream collectors