Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Tag: collections

Sorting a Java Map

Hi, a short post to show a simple tip useful when dealing with Java Maps. The following Function sorts a Map through a custom Comparator and returns a new ordered LinkedHashMap:

And this is an example of Comparator for MyClass objects sorted on the base of a String property “sortField” (note the toLowerCase method):…
Leggi tutto