Class SumOf

  • All Implemented Interfaces:
    Serializable

    public final class SumOf
    extends NumberEnvelope
    Sums of an iterable of numbers.

    Here is how you can use it to summarize numbers:

     int sum = new SumOf(1, 2, 3, 4).intValue();
     long sum = new SumOf(1L, 2L, 3L).longValue();
     int sum = new SumOf(numbers).intValue();
     

    There is no thread-safety guarantee.

    Since:
    1.0.0
    See Also:
    Serialized Form
    • Constructor Detail

      • SumOf

        public SumOf​(Number... src)
        Ctor.
        Parameters:
        src - Numbers
        Since:
        0.22
      • SumOf

        public SumOf​(Iterable<? extends Number> src)
        Ctor.
        Parameters:
        src - The iterable