Package org.plumelib.util
Class StringsPlume.NullableStringComparator
java.lang.Object
org.plumelib.util.StringsPlume.NullableStringComparator
- All Implemented Interfaces:
Serializable
,Comparator<@Nullable String>
- Enclosing class:
- StringsPlume
@Deprecated
public static class StringsPlume.NullableStringComparator
extends Object
implements Comparator<@Nullable String>, Serializable
Deprecated.
Same as built-in String comparison, but accept null arguments, and place them at the beginning.
- See Also:
-
Constructor Summary
ConstructorDescriptionDeprecated.Create a new NullableStringComparator. -
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
-
NullableStringComparator
public NullableStringComparator()Deprecated.Create a new NullableStringComparator.
-
-
Method Details
-
compare
Deprecated.Compare two Strings lexicographically. Null is considered less than any non-null String.- Specified by:
compare
in interfaceComparator<@Nullable String>
- Parameters:
s1
- first string to compares2
- second string to compare- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
-
Comparator.nullsFirst(Comparator.naturalOrder())