package nilpointer.net;
import java.util.ArrayList;
import java.util.List;
public class Demo {
public static void main(String[] args) {
List<Integer> numbers = new ArrayList<Integer>();
numbers.add(5);
numbers.add(2);
numbers.add(11);
numbers.add(-9);
numbers.add(7);
numbers.add(-4);
long min1 = numbers.stream().min((number1, number2) -> number1 - number2).get();
System.out.println("min 1: " + min1);
long min2 = numbers.stream().filter(p -> p >= 3).min((number1, number2) -> number1 - number2).get();
System.out.println("min 2: " + min2);
}
}
min 1: -9
min 2: 5