I would like to find, using Java streams, an integer i, in the range {1,...1000}, for which the function sin(i/100) is smallest. I tried to use min with comparator, as in this question:
Comparator<Integer> sineComparator = (i,j) ->
Double.compare(Math.sin(i/100.0), Math.sin(j/100.0));
IntStream.range(1,1000)
.min(sineComparator);
but it did not work since an IntStream does not have a variant of min that accepts a comparator. What can I do?