org.joo.libra.support.NumericComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of joo-libra Show documentation
Show all versions of joo-libra Show documentation
Java Predicate with SQL-like syntax support
package org.joo.libra.support;
import java.math.BigDecimal;
/**
* Utility class for comparing numbers. Both numbers will be converted into
* BigDecimal before comparing.
*
* @author griever
*
*/
public class NumericComparator {
private NumericComparator() {
}
public static int compare(final Number one, final Number other) {
return BigDecimal.valueOf(one.doubleValue()).compareTo(BigDecimal.valueOf(other.doubleValue()));
}
}