Code example for BigDecimal

Methods: hashCode

0
		return true; 
	} 
 
	public int hashCode() { 
		int result;
		result = value.hashCode();
		result = 29 * result + currency.hashCode();
		return result;
	} 
 
	public String toString() {
		return "Value: '" + getValue() + "', " + 
		        "Currency: '" + getCurrency() + "'"; 
	} 
 
	public int compareTo(Object o) {
		if (o instanceof MonetaryAmount) {
			// TODO: This would actually require some currency conversion magic 
			return this.getValue().compareTo(((MonetaryAmount) o).getValue());
		} 
		return 0;