Class Helpers.NullsBefore

  • All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<java.lang.String>
    Direct Known Subclasses:
    Helpers.NullsBeforeB, Helpers.NullsBeforeTwo
    Enclosing class:
    Helpers

    public abstract static class Helpers.NullsBefore
    extends java.lang.Object
    implements java.util.Comparator<java.lang.String>, java.io.Serializable
    Compares strings in natural order except that null comes immediately before a given value. This works better than Ordering.natural().nullsFirst() because, if null comes before all other values, it lies outside the submap/submultiset ranges we test, and the variety of tests that exercise null handling fail on those subcollections.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected NullsBefore​(java.lang.String justAfterNull)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.String lhs, java.lang.String rhs)  
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • NullsBefore

        protected NullsBefore​(java.lang.String justAfterNull)
    • Method Detail

      • compare

        public int compare​(java.lang.String lhs,
                           java.lang.String rhs)
        Specified by:
        compare in interface java.util.Comparator<java.lang.String>
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface java.util.Comparator<java.lang.String>
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object