Java Array Min Value min(T[] args)

Here you can find the source of min(T[] args)

Description

min

License

Apache License

Declaration

public static <T extends Comparable<T>> T min(T[] args) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static <T extends Comparable<T>> T min(T[] args) {
        if ((args == null) || (args.length == 0)) {
            return null;
        }/*from   w w  w.  j a  va2  s . c om*/
        T minus = null;
        for (int i = 0; i < args.length; i++) {
            T t = args[i];
            if ((minus == null) && (t != null)) {
                minus = t;
            } else if (minus.compareTo(t) > 0) {
                minus = t;
            }
        }
        return minus;
    }
}

Related

  1. min(long[] array)
  2. min(Number... array)
  3. min(Number[] array)
  4. min(T first, T... others)
  5. min(T... values)
  6. min(T[] inputArray, int i, int i0)
  7. min_max_mean_stddev(long[] counts)
  8. min_of_ints(int[] data)
  9. minAndMaxOfArray(float[] array)