Loading src/main/java/ch10c/LimitWithStream.java +12 −3 Changes for src/main/java/ch10c/LimitWithStream.java: 12 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -9,9 +9,9 @@ public class LimitWithStream { public static void main(String[] args) { List<String> strings = List.of("I", "am", "a", "list", "of", "Strings"); Stream<String> stream = strings.stream(); Stream<String> limit = stream.limit(4); List<String> result = limit.collect(Collectors.toList()); List<String> result = strings.stream() .limit(4) .collect(Collectors.toList()); System.out.println("result = " + result); } Loading @@ -38,4 +38,13 @@ public class LimitWithStream { List<String> result = limit.collect(Collectors.toList()); System.out.println("result = " + result); } void limitAsStream() { List<String> strings = List.of("I", "am", "a", "list", "of", "Strings"); List<String> result = strings.stream() .limit(4) .collect(Collectors.toList()); System.out.println("result = " + result); } } Loading
src/main/java/ch10c/LimitWithStream.java +12 −3 Changes for src/main/java/ch10c/LimitWithStream.java: 12 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -9,9 +9,9 @@ public class LimitWithStream { public static void main(String[] args) { List<String> strings = List.of("I", "am", "a", "list", "of", "Strings"); Stream<String> stream = strings.stream(); Stream<String> limit = stream.limit(4); List<String> result = limit.collect(Collectors.toList()); List<String> result = strings.stream() .limit(4) .collect(Collectors.toList()); System.out.println("result = " + result); } Loading @@ -38,4 +38,13 @@ public class LimitWithStream { List<String> result = limit.collect(Collectors.toList()); System.out.println("result = " + result); } void limitAsStream() { List<String> strings = List.of("I", "am", "a", "list", "of", "Strings"); List<String> result = strings.stream() .limit(4) .collect(Collectors.toList()); System.out.println("result = " + result); } }