diff --git a/src/com/array/rotations/PeekSample.java b/src/com/array/rotations/PeekSample.java new file mode 100644 index 0000000..d017eeb --- /dev/null +++ b/src/com/array/rotations/PeekSample.java @@ -0,0 +1,29 @@ +package com.array.rotations; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +public class PeekSample { + + public static void main(String arg[]) { + List names = Arrays.asList("Alice", "Bob", "Charlie", "David", "Edward"); + + List upperNames = names + .stream() + .peek(n-> System.out.println("Names : "+n)) + //.map(n-> n) + .collect(Collectors.toList()); + + upperNames.stream().forEach(n -> System.out.println(n)); + + String listToString = upperNames + .stream() + //.map(n->n) + .collect(Collectors.joining(", ", "[", "]")); + + + System.out.println(listToString); + } + +} diff --git a/test1.txt b/test1.txt new file mode 100644 index 0000000..5852f44 --- /dev/null +++ b/test1.txt @@ -0,0 +1 @@ +Initial commit diff --git a/test2.txt b/test2.txt new file mode 100644 index 0000000..5852f44 --- /dev/null +++ b/test2.txt @@ -0,0 +1 @@ +Initial commit