MCPcopy Create free account
hub / github.com/ShivaBhattacharjee/KeyZen / main

Method main

data/java/06_streams.java:5–20  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

3
4class StreamsDemo {
5 public static void main(String[] args) {
6 List<Integer> scores = List.of(62, 71, 85, 90, 54);
7
8 List<Integer> passed = scores.stream()
9 .filter(s -> s >= 70)
10 .sorted()
11 .collect(Collectors.toList());
12
13 double average = scores.stream()
14 .mapToInt(Integer::intValue)
15 .average()
16 .orElse(0.0);
17
18 System.out.println("Passed: " + passed);
19 System.out.println("Average: " + average);
20 }
21}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected