Int { public static long reduceBy( final int[] array, ReduceBy reduceBy ) { long sum = 0; for ( int v : array ) { sum = reduceBy.reduce(sum, v); } return sum; }  static int[] grow( int[] array, final int size ); static int[] grow( int[] array ); static int[] shrink( int[] array, int size ); static int[] compact( int[] array ); static int[] arrayOfInt( final int size ); static int[] array( final int... array ); static int lengthOf( int[] array ); static int len( int[] array ); static int idx( final int[] array, final int index ); static int atIndex( final int[] array, final int index ); static void idx( final int[] array, int index, int value ); static void atIndex( final int[] array, int index, int value ); static int[] slc( int[] array, int startIndex, int endIndex ); static int[] sliceOf( int[] array, int startIndex, int endIndex ); static int[] slc( int[] array, int startIndex ); static int[] sliceOf( int[] array, int startIndex ); static int[] slcEnd( int[] array, int endIndex ); static int[] endSliceOf( int[] array, int endIndex ); static boolean in( int value, int[] array ); static int[] copy( int[] array ); static int[] add( int[] array, int v ); static int[] add( int[] array, int[] array2 ); static int[] insert( final int[] array, final int idx, final int v ); static int[] insert( final int[] array, final int fromIndex, final int[] values ); static long reduceBy( final int[] array, ReduceBy reduceBy ); static long reduceBy( final int[] array, final int start, final int length, ReduceBy reduceBy ); static long reduceBy( final int[] array, final int length, ReduceBy reduceBy ); static long reduceBy( final int[] array, T object ); static long reduceBy( final int[] array, T object, String methodName ); static long reduceBy( final int[] array,  int length,
                                 Object object ); static long reduceBy( final int[] array,  int length,
                                 Object function, String functionName ); static long reduceBy( final int[] array, int start, int length,
                                 Object object ); static boolean equalsOrDie(int expected, int got); static boolean equalsOrDie(int[] expected, int[] got); static boolean equals(int expected, int got); static boolean equals(int[] expected, int[] got); static int sum( int[] values ); static int sum( int[] values,  int length ); static int sum( int[] values, int start, int length ); static long bigSum( int[] values ); static long bigSum( int[] values,  int length ); static long bigSum( int[] values, int start, int length ); static int max( int[] values, final int start, final int length ); static int max( int[] values ); static int max( int[] values, int length ); static int min( int[] values, final int start, final int length ); static int min( int[] values ); static int min( int[] values, int length ); static int mean( int[] values, final int start, final int length ); static int mean( int[] values, final int length ); static int mean( int[] values ); static int variance(int[] values, final int start, final int length); static double varianceDouble(int[] values, final int start, final int length); static int variance(int[] values,  final int length); static int variance(int[] values); static int standardDeviation(int[] values, final int start, final int length); static int standardDeviation(int[] values,  final int length); static int standardDeviation(int[] values); static int median(int[] values, final int start, final int length); static int median(int[] values, final int length); static int median(int[] values); static boolean equals(int start, int end, int[] expected, int[] got); static int hashCode(int array[]); static int hashCode(int start, int end, int array[]); static long sum( Collection<?> inputList, String propertyPath ); static double variance(Collection<?> inputList, String propertyPath); static double standardDeviation(Collection<?> inputList, String propertyPath); static int roundUpToPowerOf2( int number );  }
@Test public void test() { long sum = reduceBy(new int[]{1,2,3,4,5,6,7,8}, this); if (sum != 36) die(Str.sputs("Sum was 36", sum)); }
@Test public void testNewMethod() { long sum = reduceBy(new int[]{1,2,3,4,5,6,7,8}, this, "sum"); if (sum != 36) { die(Str.sputs("Sum was 36", sum)); } }