Package de.dlr.proseo.ui.gui.service
Klasse MapComparator
java.lang.Object
de.dlr.proseo.ui.gui.service.MapComparator
- Alle implementierten Schnittstellen:
Comparator<Object>
A class for comparing HashMap objects based on one or two specified keys
- Autor:
- Ernst Melchinger
-
Feldübersicht
Felder -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungMapComparator
(String key, Boolean up) Constructor that takes a key and a boolean argument for the sorting orderMapComparator
(String key, String key2, Boolean up) Constructor that takes two keys and a boolean argument for the sorting order -
Methodenübersicht
Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Von Schnittstelle geerbte Methoden java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Felddetails
-
Konstruktordetails
-
MapComparator
Constructor that takes a key and a boolean argument for the sorting order- Parameter:
key
- the key to look for in compared hash mapsup
- true, if the comparison is to be made in ascending order, false otherwise
-
MapComparator
Constructor that takes two keys and a boolean argument for the sorting order- Parameter:
key
- the key to look for in compared hash mapskey2
- the second key to look forup
- true, if the comparison is to be made in ascending order, false otherwise
-
-
Methodendetails
-
compare
Compares two objects, checks whether they are instances of HashMap and then extracts the values associated with the specified keys from each HashMap.- Angegeben von:
compare
in SchnittstelleComparator<Object>
- Parameter:
object1
- the first object (HashMap) to compareobject2
- the second object (HashMap) to compare- Gibt zurück:
- a negative value if the first object should be placed before the second object, a positive value if the first object should be placed after the second object, or zero if the objects are either not HashMaps, or null, or their keys neither integer nor string, or considered equal in terms of sorting
-