Stream is used in Manipulating collection
List<Integer> num = new ArrayList<>();
num.add(10);
num.add(20);
num.add(30);
num.add(40);
List<Integer> cubeList = num.stream().map(x -> x*x*x).collect(Collection.toList());
// get string from list to collect string starts with a
List<String> strlist = strlist.stream().filter(s -> s.startsWith("a")).collect(Collection.toList());
To take sum of list
int sum = numList.stream().reduce(0, (and, i) -> ans + i );