Class ComparisonChain.InactiveComparisonChain

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int result  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ComparisonChain compare​(double left, double right)
      Compares two double values as specified by Double.compare(double, double), if the result of this comparison chain has not already been determined.
      ComparisonChain compare​(float left, float right)
      Compares two float values as specified by Float.compare(float, float), if the result of this comparison chain has not already been determined.
      ComparisonChain compare​(int left, int right)
      Compares two int values as specified by Ints.compare(int, int), if the result of this comparison chain has not already been determined.
      ComparisonChain compare​(long left, long right)
      Compares two long values as specified by Longs.compare(long, long), if the result of this comparison chain has not already been determined.
      ComparisonChain compare​(java.lang.Comparable<?> left, java.lang.Comparable<?> right)
      Compares two comparable objects as specified by Comparable.compareTo(T), if the result of this comparison chain has not already been determined.
      <T> ComparisonChain compare​(T left, T right, java.util.Comparator<T> comparator)
      Compares two objects using a comparator, if the result of this comparison chain has not already been determined.
      ComparisonChain compareFalseFirst​(boolean left, boolean right)
      Compares two boolean values, considering false to be less than true, if the result of this comparison chain has not already been determined.
      ComparisonChain compareTrueFirst​(boolean left, boolean right)
      Compares two boolean values, considering true to be less than false, if the result of this comparison chain has not already been determined.
      int result()
      Ends this comparison chain and returns its result: a value having the same sign as the first nonzero comparison result in the chain, or zero if every result was zero.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • result

        final int result
    • Constructor Detail

      • InactiveComparisonChain

        InactiveComparisonChain​(int result)
    • Method Detail

      • compare

        public ComparisonChain compare​(java.lang.Comparable<?> left,
                                       java.lang.Comparable<?> right)
        Description copied from class: ComparisonChain
        Compares two comparable objects as specified by Comparable.compareTo(T), if the result of this comparison chain has not already been determined.

        This method is declared to accept any 2 Comparable objects, even if they are not mutually comparable. If you pass objects that are not mutually comparable, this method may throw an exception. (The reason for this decision is lost to time, but the reason might be that we wanted to support legacy classes that implement the raw type Comparable (instead of implementing Comparable<Foo>) without producing warnings. If so, we would prefer today to produce warnings in that case, and we may change this method to do so in the future. Support for raw Comparable types in Guava in general is tracked as #989.)

        Specified by:
        compare in class ComparisonChain
      • compare

        public <T> ComparisonChain compare​(T left,
                                           T right,
                                           java.util.Comparator<T> comparator)
        Description copied from class: ComparisonChain
        Compares two objects using a comparator, if the result of this comparison chain has not already been determined.
        Specified by:
        compare in class ComparisonChain
      • compare

        public ComparisonChain compare​(float left,
                                       float right)
        Description copied from class: ComparisonChain
        Compares two float values as specified by Float.compare(float, float), if the result of this comparison chain has not already been determined.
        Specified by:
        compare in class ComparisonChain
      • compare

        public ComparisonChain compare​(double left,
                                       double right)
        Description copied from class: ComparisonChain
        Compares two double values as specified by Double.compare(double, double), if the result of this comparison chain has not already been determined.
        Specified by:
        compare in class ComparisonChain
      • compareTrueFirst

        public ComparisonChain compareTrueFirst​(boolean left,
                                                boolean right)
        Description copied from class: ComparisonChain
        Compares two boolean values, considering true to be less than false, if the result of this comparison chain has not already been determined.
        Specified by:
        compareTrueFirst in class ComparisonChain
      • compareFalseFirst

        public ComparisonChain compareFalseFirst​(boolean left,
                                                 boolean right)
        Description copied from class: ComparisonChain
        Compares two boolean values, considering false to be less than true, if the result of this comparison chain has not already been determined.
        Specified by:
        compareFalseFirst in class ComparisonChain
      • result

        public int result()
        Description copied from class: ComparisonChain
        Ends this comparison chain and returns its result: a value having the same sign as the first nonzero comparison result in the chain, or zero if every result was zero.
        Specified by:
        result in class ComparisonChain