import java.util.*;
import java.util.stream.*;
public class Main{
    public static void main(String[] args)
    {
        ArrayList<Integer> al=new ArrayList<>();
        al.add(7);
        al.add(90);
        al.add(4);
        al.add(18);
        al.add(3);
        System.out.println("List : "+al);
       Stream<Integer> stm=al.stream();
       Optional<Integer> least=stm.min(Integer::compare);
       if(least.isPresent())
       System.out.println("least : "+least.get());
       stm=al.stream();
        Optional<Integer> high=stm.max(Integer::compare);
        if(high.isPresent())
       System.out.println("least : "+high.get());
       stm=al.stream();
       System.out.println("Count : "+stm.count());
       stm=al.stream();
       stm=al.stream().sorted();
       stm.forEach(n->System.out.println(n+" "));
       System.out.println("even numbers");
       stm=al.stream().filter(n->n%2==0);
       stm.forEach(n->System.out.println(n+"  "));
       System.out.println("Number of odd");
       stm=al.stream().filter(n->n%2==1).filter(n->n>5);
       stm.forEach(n->System.out.println(n+"  "));
    }
}