@@ -0,0 +1,1462 @@
+package com.github.jeffgbutler;%0A%0Aimport static org.hamcrest.core.Is.*;%0Aimport static org.junit.Assert.assertThat;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.IntStream;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * This is what's usually shown to illustrate map/filter/reduce.  It is useful to understand%0A * the basic concepts, but no one has these problems in the real world.%0A */%0Apublic class TypicalStreamExamplesTest %7B%0A%0A    @Test%0A    public void testIntStreamMapReduce() %7B%0A        int answer = IntStream.rangeClosed(1, 10)%0A                .map(i -%3E i * 3)%0A                .filter(i -%3E i %25 2 == 0)%0A                .reduce(0, (i1, i2) -%3E i1 + i2);%0A        %0A        assertThat(answer, is(90));%0A    %7D%0A%0A    @Test%0A    public void testIntStreamBuiltIns() %7B%0A        int answer = IntStream.rangeClosed(1, 10)%0A                .map(i -%3E i * 3)%0A                .filter(i -%3E i %25 2 == 0)%0A                .sum();%0A        %0A        assertThat(answer, is(90));%0A    %7D%0A    %0A    @Test%0A    public void testStrings() %7B%0A        String%5B%5D strings = %7B%22fred%22, %22pebbles%22, %22wilma%22%7D;%0A        %0A        List%3CString%3E outlist = Arrays.stream(strings)%0A                .filter(s -%3E s.length() %3C= 5)%0A                .map(String::toUpperCase)%0A                .collect(Collectors.toList());%0A        %0A        assertThat(outlist.size(), is(2));%0A        assertThat(outlist.get(0), is(%22FRED%22));%0A        assertThat(outlist.get(1), is(%22WILMA%22));%0A    %7D%0A%7D%0A

Add some typical stream examples