@Test
public void testList() {
ArrayList<Integer> arrayList = new ArrayList<>();
arrayList.add(11);
arrayList.add(22);
arrayList.add(33);
arrayList.add(44);
arrayList.add(11);
System.out.println("arrayList:" + arrayList);
arrayList.stream().forEach(x -> {
System.out.println("foreach:" + x);
});
System.out.println("------------------ filter ------------------------------");
List<Integer> c = arrayList.stream().filter(x -> x.equals(33)).collect(Collectors.toList());
System.out.println("filter:" + c);
System.out.println("------------------ distinct ------------------------------");
List<Integer> collect = arrayList.stream().distinct().collect(Collectors.toList());
System.out.println("distinct:" + collect);
System.out.println("------------------ limit ------------------------------");
List<Integer> collect1 = arrayList.stream().limit(3).collect(Collectors.toList());
System.out.println("limit:" + collect1);
System.out.println("------------------ min ------------------------------");
int minValue = arrayList.stream().min(Comparator.comparing(Integer::intValue)).get().intValue();
System.out.println("max:" + minValue);
System.out.println("------------------ max ------------------------------");
int maxValue = arrayList.stream().max(Comparator.comparing(Integer::intValue)).get().intValue();
System.out.println("max:" + maxValue);
}