Class SafeOperations


  • public final class SafeOperations
    extends java.lang.Object
    Provides safe arithmetic operations to avoid, for example, numeric overflows.
    Since:
    1.0.0-alpha4
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SafeOperations()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int add​(int... values)
      Applies Math.addExact(int, int) to a variable length array of integers.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SafeOperations

        private SafeOperations()
    • Method Detail

      • add

        public static int add​(int... values)
        Applies Math.addExact(int, int) to a variable length array of integers.
        Parameters:
        values - variable length array of integers.
        Returns:
        the values safely added.