Class BigIntCollectionUtil


  • public class BigIntCollectionUtil
    extends Object
    Utility methods for collections of BigIntegers.
    Author:
    Tilman Neumann
    • Constructor Detail

      • BigIntCollectionUtil

        public BigIntCollectionUtil()
    • Method Detail

      • stringToList

        public static ArrayList<BigInteger> stringToList​(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 BigInteger sum​(Collection<BigInteger> c)
        Parameters:
        c - a collection of BigIntegers
        Returns:
        The sum of all elements of collection c.
      • absSum

        public static BigInteger absSum​(Collection<BigInteger> c)
        Parameters:
        c - a collection of BigIntegers
        Returns:
        The sum of the absolute values of the elements of collection c.
      • product

        public static BigInteger product​(Collection<BigInteger> c)
        Parameters:
        c - a collection of BigIntegers
        Returns:
        The product of all elements of collection c, 0 if the collection is empty.