boon/src/main/java/org/boon/primitive/Dbl.java
private  static <T> double reduceByR( final double[] array, T object ) {
        try {

            Method method = Invoker.invokeReducerLongIntReturnLongMethod(object);


            double sum = 0;
            for ( double v : array ) {
                sum = (double) method.invoke(object, sum, v);

            }
            return sum;

        } catch (Throwable throwable) {
            return handle(Long.class, throwable, "Unable to perform reduceBy");
        }

    }
private  static <T> double reduceByR( final double[] array, T object ) {
        try {

            Method method = Invoker.invokeReducerLongIntReturnLongMethod(object);


            double sum = 0;
            for ( double v : array ) {
                sum = (double) method.invoke(object, sum, v);

            }
            return sum;

        } catch (Throwable throwable) {
            return handle(Long.class, throwable, "Unable to perform reduceBy");
        }

    }
private static < T > double reduceByR ( final double [ ] array , T object ) { try { Method method = Invoker . invokeReducerLongIntReturnLongMethod ( object ) ; double sum = 0 ; for ( double v : array ) { sum = ( double ) method . invoke ( object , sum , v ) ; } return sum ; } catch ( Throwable throwable ) { return handle ( Long . class , throwable , "Unable to perform reduceBy" ) ; } }
Fallback to reflection if the call-site will not work or did not work
@param array array of items to reduce by
@param object function object
@param <T> type of function object.
@return
Fallback to reflection if the call - site will not work or did not work