Package org.rapidcontext.core.data
Class DictComparator
java.lang.Object
org.rapidcontext.core.data.DictComparator
- All Implemented Interfaces:
Comparator<Object>
A dictionary value comparator. This comparator only compares the
values of two dictionary keys. All values returned which must
implement Comparable and be of compatible types.
- Version:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
DictComparator
Creates a new dictionary comparator.- Parameters:
key
- the dictionary key name
-
-
Method Details
-
compare
Compares two dictionaries by comparing their values for a predefined property key.- Specified by:
compare
in interfaceComparator<Object>
- Parameters:
o1
- the first objecto2
- the second object- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
- Throws:
ClassCastException
- if the values were not comparable
-