Class MinMax


  • public class MinMax
    extends Object
    MinMax.java

    Improved Math.min and Math.max from standard java library. This class implements advanced min/max methods that allow an arbitrary number of arguments.

    Usage example:

     
     MinMax.min(1,2,-5,...,n);
     MinMax.min(1.2,2.3,-5.0,...,n.n);
     MinMax.max(1,2,-5,...,n);
     MinMax.max(1.2,2.3,-5.0,...,n.n);
     
     
    Version:
    2.0.0
    Author:
    Cristian Sorescu (christian139601@gmail.com)
    • Constructor Detail

      • MinMax

        public MinMax()
    • Method Detail

      • min

        @SafeVarargs
        public static <T extends Number & Comparable<T>> T min​(T... numbers)
        Returns the minimum of the given numbers.
        Parameters:
        numbers - The given numbers.
        Returns:
        The minimum of the given numbers.
      • max

        @SafeVarargs
        public static <T extends Number & Comparable<T>> T max​(T... numbers)
        Returns the maximum of the given numbers.
        Parameters:
        numbers - The given numbers.
        Returns:
        The maximum of the given numbers.