public T add ( T addend ) { if ( addend == null ) { throw new IllegalArgumentException ( "invalid (null) addend" ) ; } BigDecimal sum = this . value . add ( addend . value ) ; return newInstance ( sum , sum . scale ( ) ) ; }
Wraps BigDecimal s add method to accept and return T instances instead of BigDecimals so that users of the class don t have to typecast the return value .