I have two lists:
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> mappedNums = Arrays.asList(2.1, 0.3, 1.2);
I would like to sort nums
according to mappedNums
: I would like to nums
to be [0.9, 10.4, 5.0]
, since the 0.9
is the second element of nums
, and the second element of mappedNums
is the smallest, and so on. How do I do that?