BigDecimal
isn't a primitive, so you cannot use the <
, >
operators. However, since it's a Comparable
, you can use the compareTo(BigDecimal)
to the same effect. E.g.:
public class Domain {
private BigDecimal unitPrice;
public boolean isCheaperThan(BigDecimal other) {
return unitPirce.compareTo(other.unitPrice) < 0;
}
// etc...
}