Package adams.core
Class AbstractDataBackedRange.InvertedStringLengthComparator
- java.lang.Object
-
- adams.core.AbstractDataBackedRange.InvertedStringLengthComparator
-
- All Implemented Interfaces:
Serializable
,Comparator<String>
- Enclosing class:
- AbstractDataBackedRange<T>
public static class AbstractDataBackedRange.InvertedStringLengthComparator extends Object implements Comparator<String>, Serializable
Simply compares the length of the strings, with longer strings rating lower.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InvertedStringLengthComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(String o1, String o2)
Compares the two strings.-
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
-
-
-
-
Method Detail
-
compare
public int compare(String o1, String o2)
Compares the two strings. Returns -1 if o1 longer than o2, returns 0 if both strings have the same length, returns 1 if o2 longer than o1.- Specified by:
compare
in interfaceComparator<String>
- Parameters:
o1
- first stringo2
- second string- Returns:
- the comparison result
-
-