I am using TreeBidiMap from the Apache Collections library. I want to sort this on the values which are doubles.
My method is to retrieve a Collection of the values using:
Collection coll = themap.values();
Which naturally works fine.
Main …
In Java you can build up an ArrayList with items and then call:
Collections.sort(list, comparator);
Is there anyway to pass in the Comparator at the time of list, creation like you can do with TreeMap?
The goal is …
I'm interested in sorting a list from a stream. This is the code I'm using:
list.stream()
.sorted((o1, o2)->o1.getItem().getValue().compareTo(o2.getItem().getValue()))
.collect(Collectors.toList());
Am I missing something? The list is not …