·
Here an animation made by Java Champion Tagir Valeev
, which illustrates Java Stream API processing:
AtomicLong cnt = new AtomicLong();
source .stream()
.map(x -> x.squash())
.peek(x -> cnt.incrementAndGet())
.filter(x -> x.getColor() != YELLOW)
.forEach(System.out::println);