Class Operator


  • public final class Operator
    extends Object
    Author:
    David B. Bracewell
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double add​(double v1, double v2)
      Adds two doubles (useful as a method reference)
      static float add​(float v1, float v2)
      Adds two float (useful as a method reference)
      static int add​(int v1, int v2)
      Adds two int (useful as a method reference)
      static long add​(long v1, long v2)
      Adds two int (useful as a method reference)
      static double divide​(double v1, double v2)
      Divides two doubles (useful as a method reference)
      static float divide​(float v1, float v2)
      Divides two float (useful as a method reference)
      static int divide​(int v1, int v2)
      Divides two int (useful as a method reference)
      static double multiply​(double v1, double v2)
      Multiplies two doubles (useful as a method reference)
      static float multiply​(float v1, float v2)
      Multiplies two float (useful as a method reference)
      static int multiply​(int v1, int v2)
      Multiplies two int (useful as a method reference)
      static double subtract​(double v1, double v2)
      Subtracts two doubles (useful as a method reference)
      static float subtract​(float v1, float v2)
      Subtracts two float (useful as a method reference)
      static int subtract​(int v1, int v2)
      Subtracts two int (useful as a method reference)
    • Method Detail

      • add

        public static float add​(float v1,
                                float v2)
        Adds two float (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the sum of value 1 and value 2
      • add

        public static double add​(double v1,
                                 double v2)
        Adds two doubles (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the sum of value 1 and value 2
      • add

        public static int add​(int v1,
                              int v2)
        Adds two int (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the sum of value 1 and value 2
      • add

        public static long add​(long v1,
                               long v2)
        Adds two int (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the sum of value 1 and value 2
      • divide

        public static float divide​(float v1,
                                   float v2)
        Divides two float (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 divided by value 2
      • divide

        public static double divide​(double v1,
                                    double v2)
        Divides two doubles (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 divided by value 2
      • divide

        public static int divide​(int v1,
                                 int v2)
        Divides two int (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 divided by value 2
      • multiply

        public static float multiply​(float v1,
                                     float v2)
        Multiplies two float (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 * value 2
      • multiply

        public static double multiply​(double v1,
                                      double v2)
        Multiplies two doubles (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 * value 2
      • multiply

        public static int multiply​(int v1,
                                   int v2)
        Multiplies two int (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 * value 2
      • subtract

        public static float subtract​(float v1,
                                     float v2)
        Subtracts two float (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 minus value 2
      • subtract

        public static double subtract​(double v1,
                                      double v2)
        Subtracts two doubles (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 minus value 2
      • subtract

        public static int subtract​(int v1,
                                   int v2)
        Subtracts two int (useful as a method reference)
        Parameters:
        v1 - value 1
        v2 - value 2
        Returns:
        the result of value 1 minus value 2