findFirst() — returns the first element by encounter order. min() — returns the minimum element by Comparator. Think of findFirst() as the person at the front of the line (position-based), while min() as the smallest person in the group (value-based).
findFirst():
Optional<T>.1Optional<Integer> first = list.stream()2 .findFirst();3// Returns first element, e.g., 5 from [5, 3, 1, 4]
min():
Optional<T>.1Optional<Integer> min = list.stream()2 .min(Integer::compareTo);3// Returns smallest element, e.g., 1 from [5, 3, 1, 4]
Key difference:
1// findFirst() returns the first matching element2Optional<String> first = list.stream()3 .filter(s -> s.length() > 3)4 .findFirst();56// min() returns the shortest string matching7Optional<String> shortest = list.stream()8 .filter(s -> s.length() > 3)9 .min(Comparator.comparing(String::length));