Java Utililty Methods BigDecimal Equal

List of utility methods to do BigDecimal Equal

Description

The list of methods to do BigDecimal Equal are organized into topic(s).

Method

booleanbigDecimalEqual(BigDecimal a, BigDecimal b)
big Decimal Equal
return (a == b) || (a != null && b != null && a.compareTo(b) == 0);
booleanbigDecimalEquals(BigDecimal a, Number b)
big Decimal Equals
if (b instanceof BigDecimal) {
    return bigDecimalEquals(a, (BigDecimal) b);
} else if (b instanceof BigInteger) {
    return bigDecimalEquals(a, new BigDecimal((BigInteger) b));
} else {
    return false;
booleanbigDecimalEqualsOrBothNull(BigDecimal obj1, BigDecimal obj2)
big Decimal Equals Or Both Null
if (obj1 == null && obj2 == null) {
    return true;
if (obj1 != null && obj2 != null) {
    return obj1.compareTo(obj2) == 0;
return false;
booleanequalBD(BigDecimal val1, BigDecimal val2)
Bepaalt of 2 BigDecimals gelijk zijn.
if (val1 == null && val2 == null) {
    return true;
if ((val1 == null && val2 != null) || (val2 == null && val1 != null)) {
    return false;
return (val1.compareTo(val2) == 0);
booleanequals(BigDecimal a, BigDecimal b)
equals
return (a == b) || (a != null && a.compareTo(b) == 0);
booleanequals(BigDecimal bd1, BigDecimal bd2)
equals
return isZero(doubleValue(bd1) - doubleValue(bd2));
booleanequals(BigDecimal decimal, double number)
equals
return equals(decimal, new BigDecimal(number));
booleanequals(BigDecimal left, BigDecimal right, int scale)
equals
if (left == null || right == null) {
    return (left == right);
if (scale <= 0) {
    scale = Math.min(left.scale(), right.scale());
} else
    scale = Math.min(Math.min(left.scale(), right.scale()), scale);
...
booleanEquals(BigDecimal one, BigDecimal two)
Returns true if one == two
return (one.compareTo(two) == 0);
booleanequals(final BigDecimal b0, final BigDecimal b1, final double delta)
Null safe equals with accepted delta.
if (b0 == b1) {
    return true;
} else if (b0 == null || b1 == null) {
    return false;
} else {
    return b0.subtract(b1).abs().compareTo(BigDecimal.valueOf(Math.abs(delta))) <= 0;