public class NumberAwareComparator<T>
extends Object
implements Comparator, 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.
| Constructor and description |
|---|
NumberAwareComparator()Compares without forcing +0.0 and -0.0 to be equal.
|
NumberAwareComparator(boolean ignoreZeroSign)
|
| Type Params | Return Type | Name and description |
|---|---|---|
|
public int |
compare(T o1, T o2)Compares two values using Groovy comparison semantics with numeric coercion. |
Compares without forcing +0.0 and -0.0 to be equal.
Same as NumberAwareComparator(boolean) with that flag false.
Compares two values using Groovy comparison semantics with numeric coercion.
o1 - the first value to compareo2 - the second value to compareCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.