java.lang.Object
omix.util.collections.StringComparator
- All Implemented Interfaces:
Serializable
,Comparator<String>
public class StringComparator extends Object implements Comparator<String>, Serializable
Compares two strings.
- Author:
- Dr. Peter Droste, Omix Visualization
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static StringComparator
INSTANCE
The only available instance of this class. -
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
-
Field Details
-
INSTANCE
The only available instance of this class.
-
-
Method Details
-
compare
Compares two strings.- Specified by:
compare
in interfaceComparator<String>
- Parameters:
strg1
- first stringstrg2
- second string- Returns:
- 0 if strings are equals, 1 if str1 is greater than strg2 and -1 otherwise. A String is greater than another if its length is greater. If the length is equals, the one is greater containing the first higher character value.
- See Also:
Comparator.compare(java.lang.Object, java.lang.Object)
-