Class ComparisonChain.InactiveComparisonChain

java.lang.Object
com.google.common.collect.ComparisonChain
com.google.common.collect.ComparisonChain.InactiveComparisonChain
Enclosing class:
ComparisonChain

private static final class ComparisonChain.InactiveComparisonChain extends ComparisonChain
  • Field Details

    • result

      final int result
  • Constructor Details

    • InactiveComparisonChain

      InactiveComparisonChain(int result)
  • Method Details

    • compare

      public ComparisonChain compare(Comparable<?> left, 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, 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(int left, int right)
      Description copied from class: ComparisonChain
      Compares two int values as specified by Integer.compare(int, int), if the result of this comparison chain has not already been determined.
      Specified by:
      compare in class ComparisonChain
    • compare

      public ComparisonChain compare(long left, long right)
      Description copied from class: ComparisonChain
      Compares two long values as specified by Long.compare(long, long), 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.

      Java 8+ users: you can get the equivalent from Booleans.trueFirst(). For example:

       Comparator.comparing(Foo::isBar, Booleans.trueFirst())
       
      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.

      Java 8+ users: you can get the equivalent from Booleans.falseFirst(). For example:

       Comparator.comparing(Foo::isBar, Booleans.falseFirst())
       
      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