import java.util.*;
public class CollectionsMaxExample2 {
public static void main(String[] args) {
//Create collections lists.
List<Integer> list = Arrays.asList(20, 10, 100, 140, 250);
Integer max = Collections.max(list);
System.out.println("Maximum element is: "+max);
}
int max = (The provided List).stream().max((i1,i2)->(i1>i2)?1:(i1<i2)-1:0).get();