Java Number Min Value min(T v1, T v2, int nullSupport)

Here you can find the source of min(T v1, T v2, int nullSupport)

Description

min

License

Apache License

Declaration

public static <T extends Comparable<T>> T min(T v1, T v2, int nullSupport) 

Method Source Code

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

public class Main {
    public static final int NULL_IS_MINIMUM = 1;

    public static <T extends Comparable<T>> T min(T v1, T v2, int nullSupport) {
        if (v1 == v2)
            return v1;
        if (v1 == null) {
            return nullSupport == NULL_IS_MINIMUM ? v1 : v2;
        }//from  w  ww . j  a va  2s.  co m
        if (v2 == null) {
            return nullSupport == NULL_IS_MINIMUM ? v2 : v1;
        }
        int v = v1.compareTo(v2);
        return (v > 0) ? v2 : v1;
    }
}

Related

  1. min(String s)
  2. min(T a, T b)
  3. min(T a, T b)
  4. min(T c1, T c2)
  5. min(T v1, T v2)
  6. min2(double a, double b)
  7. min2(int a, int b)
  8. min2msec(int min)
  9. min2sex(Integer minutes)