Java Collections
don't have any order associated with them. You could turn the Collection
into a List
first and then sort it.
Collection<List<EventiPerGiorno>> collection = mapEventi.values()
YourComparableList<List<EventiPerGiorno>> list = new YourComparableList(collection);
Collections.sort(list);
For this, you will need to create some sort of List
that implements Comparable
. See How do I correctly implement Comparable for List in this instance? for an example.
Note that this is sorting the objects of type List<EventiPerGiorno>
, not the objects of type EventiPerGiorno
. If you are interested in sorting the latter, you might want this instead:
ArrayList<EventiPerGiorno> bigList = new ArrayList<EventiPerGiorno>();
for (List<EventiPerGiorno> list : mapEventi.values()) {
bigList.addAll(list);
}
Collections.sort(bigList);