MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

concurrent/CollectionIntoStream.java:10–22  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

8
9public class CollectionIntoStream {
10 public static void main(String[] args) {
11 List<String> strings =
12 Stream.generate(new Rand.String(5))
13 .limit(10)
14 .collect(Collectors.toList());
15 strings.forEach(System.out::println);
16 // Convert to a Stream for many more options:
17 String result = strings.stream()
18 .map(String::toUpperCase)
19 .map(s -> s.substring(2))
20 .reduce(":", (s1, s2) -> s1 + s2);
21 System.out.println(result);
22 }
23}
24/* Output:
25btpen

Callers

nothing calls this directly

Calls 1

streamMethod · 0.45

Tested by

no test coverage detected