Package edu.byu.hbll.box.internal.util
Class NumberComparator
java.lang.Object
edu.byu.hbll.box.internal.util.NumberComparator
- All Implemented Interfaces:
Comparator<Number>
Compares
Number
s numerically. For example, an Integer
and a BigDecimal
with the same numeric value will be considered equal even though they are of two different number
types.
Derived from https://stackoverflow.com/questions/2683202/comparing-the-values-of-two-generic-numbers/2683438.
- Author:
- Charles Draper
-
Constructor Summary
Constructors -
Method Summary
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
-
NumberComparator
public NumberComparator()
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<Number>
-