util
Class CollectionMath

java.lang.Object
  extended by util.CollectionMath

public class CollectionMath
extends Object

Utility math methods defined over collections of elements


Constructor Summary
CollectionMath()
           
 
Method Summary
static Float sumFloat(FnIterable<Float> it)
           
static FnIterable<Float> sumFloat(FnIterable<Float> c1, FnIterable<Float> c2)
          Pair-wise sum of two sequences of floats.
static Float sumFloat(Iterable<Float> c)
           
static Collection<Float> sumFloat(Iterable<Float> c1, Iterable<Float> c2)
          Pair-wise sum of two iterators over floats.
static Integer sumInteger(FnIterable<Integer> it)
           
static FnIterable<Integer> sumInteger(FnIterable<Integer> c1, FnIterable<Integer> c2)
          Pair-wise sum of two sequences of integers.
static Integer sumInteger(Iterable<Integer> c)
           
static Collection<Integer> sumInteger(Iterable<Integer> c1, Collection<Integer> c2)
          Pair-wise sum of two iterators over integers.
static Long sumLong(FnIterable<Long> it)
           
static FnIterable<Long> sumLong(FnIterable<Long> c1, FnIterable<Long> c2)
          Pair-wise sum of two sequences of longs.
static Long sumLong(Iterable<Long> c)
           
static Collection<Long> sumLong(Iterable<Long> c1, Iterable<Long> c2)
          Pair-wise sum of two iterators over longs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionMath

public CollectionMath()
Method Detail

sumInteger

public static Integer sumInteger(Iterable<Integer> c)
Parameters:
c - a collection of integers
Returns:
sum of the collection of integers

sumInteger

public static Integer sumInteger(FnIterable<Integer> it)
Parameters:
it - a sequence of integers
Returns:
sum of the sequence of integers

sumInteger

public static Collection<Integer> sumInteger(Iterable<Integer> c1,
                                             Collection<Integer> c2)
Pair-wise sum of two iterators over integers. Iterators should have the same length.

Parameters:
c1 - first iterator
c2 - second iterator
Returns:
iterator over the pair-wise sum of two argument iterators

sumInteger

public static FnIterable<Integer> sumInteger(FnIterable<Integer> c1,
                                             FnIterable<Integer> c2)
Pair-wise sum of two sequences of integers. Sequences should have the same length.
  sumInteger({a1, a2, a3, ...}, {b1, b2, b3, ...}) ==> {a1+b1, a2+b2, a3+b3, ...}
 

Parameters:
c1 - first sequence
c2 - second sequence
Returns:
sequence of pair-wise sum of two argument sequences

sumLong

public static Long sumLong(Iterable<Long> c)
Parameters:
c - a collection of longs
Returns:
sum of the collection of longs

sumLong

public static Long sumLong(FnIterable<Long> it)
Parameters:
it - a sequence of longs
Returns:
sum of the sequence of longs

sumLong

public static Collection<Long> sumLong(Iterable<Long> c1,
                                       Iterable<Long> c2)
Pair-wise sum of two iterators over longs. Iterators should have the same length.

Parameters:
c1 - first iterator
c2 - second iterator
Returns:
iterator over the pair-wise sum of two argument iterators

sumLong

public static FnIterable<Long> sumLong(FnIterable<Long> c1,
                                       FnIterable<Long> c2)
Pair-wise sum of two sequences of longs. Sequences should have the same length.
  sumLong({a1, a2, a3, ...}, {b1, b2, b3, ...}) ==> {a1+b1, a2+b2, a3+b3, ...}
 

Parameters:
c1 - first sequence
c2 - second sequence
Returns:
sequence of pair-wise sum of two argument sequences

sumFloat

public static Float sumFloat(Iterable<Float> c)
Parameters:
c - a collection of floats
Returns:
sum of the collection of floats

sumFloat

public static Float sumFloat(FnIterable<Float> it)
Parameters:
it - a sequence of floats
Returns:
sum of the sequence of floats

sumFloat

public static Collection<Float> sumFloat(Iterable<Float> c1,
                                         Iterable<Float> c2)
Pair-wise sum of two iterators over floats. Iterators should have the same length.

Parameters:
c1 - first iterator
c2 - second iterator
Returns:
iterator over the pair-wise sum of two argument iterators

sumFloat

public static FnIterable<Float> sumFloat(FnIterable<Float> c1,
                                         FnIterable<Float> c2)
Pair-wise sum of two sequences of floats. Sequences should have the same length.
  sumFloat({a1, a2, a3, ...}, {b1, b2, b3, ...}) ==> {a1+b1, a2+b2, a3+b3, ...}
 

Parameters:
c1 - first sequence
c2 - second sequence
Returns:
sequence of pair-wise sum of two argument sequences