Package de.tilman_neumann.jml.base
Class BigIntCollectionUtil
java.lang.Object
de.tilman_neumann.jml.base.BigIntCollectionUtil
public class BigIntCollectionUtil
extends java.lang.Object
Utility methods for collections of BigIntegers.
-
Constructor Summary
Constructors Constructor Description BigIntCollectionUtil()
-
Method Summary
Modifier and Type Method Description static java.math.BigInteger
absSum(java.util.Collection<java.math.BigInteger> c)
static java.math.BigInteger
product(java.util.Collection<java.math.BigInteger> c)
static java.util.ArrayList<java.math.BigInteger>
stringToList(java.lang.String str)
Factory method creating a list of big integers from the given comma-separated string.static java.math.BigInteger
sum(java.util.Collection<java.math.BigInteger> c)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
BigIntCollectionUtil
public BigIntCollectionUtil()
-
-
Method Details
-
stringToList
public static java.util.ArrayList<java.math.BigInteger> stringToList(java.lang.String str)Factory method creating a list of big integers from the given comma-separated string.- Parameters:
str
-- Returns:
- list of big integers
-
sum
public static java.math.BigInteger sum(java.util.Collection<java.math.BigInteger> c)- Parameters:
c
- a collection of BigIntegers- Returns:
- The sum of all elements of collection c.
-
absSum
public static java.math.BigInteger absSum(java.util.Collection<java.math.BigInteger> c)- Parameters:
c
- a collection of BigIntegers- Returns:
- The sum of the absolute values of the elements of collection c.
-
product
public static java.math.BigInteger product(java.util.Collection<java.math.BigInteger> c)- Parameters:
c
- a collection of BigIntegers- Returns:
- The product of all elements of collection c, 0 if the collection is empty.
-