@Test @SuppressWarnings( "all" ) public void testNitPicks() { Object c = (1.0 > 2 ? 1.0 : 2); assert c.getClass() == Double.class && c.equals( 2.0 ); assert toNumber("123").equals( Optional.of( 123 ) ); assert toNumber("123123123123123123").equals( Optional.of( 123123123123123123l ) ); assert toNumber("123123123123123123123123123123123123").equals( Optional.of( 123123123123123123123123123123123123d ) ); assert abs( "-123" ).equals( Optional.of( 123 )); assert abs("-123123123123123123").equals( Optional.of( 123123123123123123l ) ); assert abs("-123123123123123123123123123123123123").equals( Optional.of( 123123123123123123123123123123123123d ) ); }
public static Optional<Number> abs( Object arg ) { if(arg instanceof Integer) { return Optional.<Number>of( java.lang.Math.abs( (Integer) arg )); } else if(arg instanceof Double) { return Optional.<Number>of( java.lang.Math.abs( (Double) arg )); } else if(arg instanceof Long) { return Optional.<Number>of( java.lang.Math.abs( (Long) arg )); } else if(arg instanceof String) { return abs( Objects.toNumber( arg ).get() ); } return Optional.empty(); }
Math { public static Optional<Number> abs( Object arg ) { if(arg instanceof Integer) { return Optional.<Number>of( java.lang.Math.abs( (Integer) arg )); } else if(arg instanceof Double) { return Optional.<Number>of( java.lang.Math.abs( (Double) arg )); } else if(arg instanceof Long) { return Optional.<Number>of( java.lang.Math.abs( (Long) arg )); } else if(arg instanceof String) { return abs( Objects.toNumber( arg ).get() ); } return Optional.empty(); } }
Math { public static Optional<Number> abs( Object arg ) { if(arg instanceof Integer) { return Optional.<Number>of( java.lang.Math.abs( (Integer) arg )); } else if(arg instanceof Double) { return Optional.<Number>of( java.lang.Math.abs( (Double) arg )); } else if(arg instanceof Long) { return Optional.<Number>of( java.lang.Math.abs( (Long) arg )); } else if(arg instanceof String) { return abs( Objects.toNumber( arg ).get() ); } return Optional.empty(); }  }
Math { public static Optional<Number> abs( Object arg ) { if(arg instanceof Integer) { return Optional.<Number>of( java.lang.Math.abs( (Integer) arg )); } else if(arg instanceof Double) { return Optional.<Number>of( java.lang.Math.abs( (Double) arg )); } else if(arg instanceof Long) { return Optional.<Number>of( java.lang.Math.abs( (Long) arg )); } else if(arg instanceof String) { return abs( Objects.toNumber( arg ).get() ); } return Optional.empty(); }  static Optional<Number> max( List<Object> args ); static Optional<Number> min( List<Object> args ); static Optional<Number> abs( Object arg ); static Optional<Double> avg(List<Object> args); static Optional<Integer> intSum(List<Object> args); static Optional<Double> doubleSum(List<Object> args); static Optional<Long> longSum(List<Object> args); static Optional<Integer> intSubtract(List<Object> argList); static Optional<Double> doubleSubtract(List<Object> argList); static Optional<Long> longSubtract(List<Object> argList); static Optional<Double> divide(List<Object> argList); static Optional<Double> divideAndRound(List<Object> argList, int digitsAfterDecimalPoint ); }
Math { public static Optional<Number> abs( Object arg ) { if(arg instanceof Integer) { return Optional.<Number>of( java.lang.Math.abs( (Integer) arg )); } else if(arg instanceof Double) { return Optional.<Number>of( java.lang.Math.abs( (Double) arg )); } else if(arg instanceof Long) { return Optional.<Number>of( java.lang.Math.abs( (Long) arg )); } else if(arg instanceof String) { return abs( Objects.toNumber( arg ).get() ); } return Optional.empty(); }  static Optional<Number> max( List<Object> args ); static Optional<Number> min( List<Object> args ); static Optional<Number> abs( Object arg ); static Optional<Double> avg(List<Object> args); static Optional<Integer> intSum(List<Object> args); static Optional<Double> doubleSum(List<Object> args); static Optional<Long> longSum(List<Object> args); static Optional<Integer> intSubtract(List<Object> argList); static Optional<Double> doubleSubtract(List<Object> argList); static Optional<Long> longSubtract(List<Object> argList); static Optional<Double> divide(List<Object> argList); static Optional<Double> divideAndRound(List<Object> argList, int digitsAfterDecimalPoint );  }