Isn't it obvious that min() function should compute the minimum element in the collection and return us the data?
I can accept the fact for User defined objects like Person, Animal etc... we have to provide comparator to compute the min element. But for universally accepted types like Integer, String, Double why does it try to accept comparator implementation.
It could have been overloaded functions like?
1.
min() => Just for types like Integer, String, Double etc..
2.
min(Comparator c) => for types like user defined objects like Person etc...
eg.,
List<Integer> list = new ArrayList<>();
The fact that list.stream().min(/I can still pass a comparator that computes maximum Integer data and breach the underlying intent of the function right?/)