Index: web-module/src/test/java/egovframework/com/ext/jstree/support/util/Java8LambdaTest.java =================================================================== diff -u -r366cf516bedd4538eb63dbff96de1ffc659d30ba -r439e35563715460ed013f7ff95433cb7da347da8 --- web-module/src/test/java/egovframework/com/ext/jstree/support/util/Java8LambdaTest.java (.../Java8LambdaTest.java) (revision 366cf516bedd4538eb63dbff96de1ffc659d30ba) +++ web-module/src/test/java/egovframework/com/ext/jstree/support/util/Java8LambdaTest.java (.../Java8LambdaTest.java) (revision 439e35563715460ed013f7ff95433cb7da347da8) @@ -2,6 +2,11 @@ import org.junit.Test; +import java.util.Arrays; +import java.util.List; +import java.util.stream.IntStream; +import java.util.stream.Stream; + /** * Created by Administrator on 2018-07-12. */ @@ -26,4 +31,46 @@ r2.run(); } + @Test + public void functionalJavaOutLine() { + List myList = + Arrays.asList("a1", "a2", "b1", "c2", "c1"); + + myList + .stream() + .filter(s -> s.startsWith("c")) + .map(String::toUpperCase) + .sorted() + .forEach(System.out::println); + } + + @Test + public void functionalJavaStreamTest(){ + Arrays.asList("a1", "a2", "a3") + .stream() + .findFirst() + .ifPresent(System.out::println); + } + + @Test + public void fuctionalJavaStreamNoneCollectionTest(){ + Stream.of("a1", "a2", "a3") + .findFirst() + .ifPresent(System.out::println); + } + + @Test + public void functionJavaIntStreamTest(){ + IntStream.range(1, 4) + .forEach(System.out::println); + } + + @Test + public void functionJavaPridicateTest(){ + Arrays.stream(new int[] {1, 2, 3}) + .map(n -> 2 * n + 1) + .average() + .ifPresent(System.out::println); + } + }