Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package me.juanmacias;
import java.util.Arrays;
import java.util.List;
public class Gotcha1NoTerminalOperation {
public static void main(String[] args) {
List<String> eulogy = Arrays.asList("yo", "quiero", "ser", "llorando", "el", "hortelano");
Stream<String> eulogyStream = -> {
System.out.println("while filtering (intermediate operation)... " + word);
return word.contains("a");
}).map(word -> {
System.out.println("while uppercasing (intermediate operation)... " + word);
return word.toUpperCase();
// eulogyStream.peek(word -> System.out.println("peeking before counting (terminal operation)... " + word)).count();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.