@@ -0,0 +1,1014 @@
+package com.mpakhomov;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Comparator;%0Aimport java.util.List;%0Aimport java.util.Optional;%0Aimport java.util.OptionalInt;%0Aimport java.util.stream.Collectors;%0A%0A/**%0A * @author mpakhomov%0A * @since 9/22/2015%0A */%0Apublic class FindMax %7B%0A    public static void main(String%5B%5D args) %7B%0A        List%3CInteger%3E l = Arrays.asList(1, 2, 3, 4, 5);%0A%0A        Optional%3CInteger%3E max = l.stream().reduce((a, b) -%3E a %3E b ? a : b);%0A        System.out.println(max);%0A%0A        OptionalInt max1 = l.stream().mapToInt(Integer::intValue).max();%0A        System.out.println(max1);%0A%0A        max = l.stream().max(Comparator.naturalOrder());%0A        System.out.println(max);%0A%0A        max = l.stream().reduce(Integer::max);%0A        System.out.println(max);%0A%0A        max = l.stream().collect(Collectors.maxBy(Comparator.naturalOrder()));%0A        System.out.println(max);%0A%0A        int maximum = l.stream().collect(Collectors.summarizingInt(Integer::intValue)).getMax();%0A        System.out.println(maximum);%0A    %7D%0A%7D%0A

Find maximum element