Class NumberAwareComparator<T>

java.lang.Object
org.codehaus.groovy.runtime.NumberAwareComparator<T>
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<T>

public class NumberAwareComparator<T>
extends java.lang.Object
implements java.util.Comparator<T>, java.io.Serializable
Compares two objects using Groovy's friendly comparison algorithm, i.e. handles nulls gracefully (nul being less than everything else) and performs numeric type coercion if required.
See Also:
Serialized Form
  • Constructor Summary

    Constructors
    Constructor Description
    NumberAwareComparator()  
    NumberAwareComparator​(boolean ignoreZeroSign)  
  • Method Summary

    Modifier and Type Method Description
    int compare​(T o1, T o2)  

    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

    • NumberAwareComparator

      public NumberAwareComparator()
    • NumberAwareComparator

      public NumberAwareComparator​(boolean ignoreZeroSign)
      Since:
      3.0.8
  • Method Details

    • compare

      public int compare​(T o1, T o2)
      Specified by:
      compare in interface java.util.Comparator<T>