Here you can find the source of min(Integer i1, Integer i2)
Parameter | Description |
---|---|
i1 | the first Integer. |
i2 | the second Integer. |
public static Integer min(Integer i1, Integer i2)
//package com.java2s; /*//www.ja va2s . c o m * Copyright (c) 2013-2017 QuartzDesk.com. * Licensed under the MIT license (https://opensource.org/licenses/MIT). */ public class Main { /** * Returns the smaller of the two Integers. A null Integer * is treated as smaller then {@link Integer#MIN_VALUE}. * * @param i1 the first Integer. * @param i2 the second Integer. * @return the smaller of the two Integers. */ public static Integer min(Integer i1, Integer i2) { if (i1 != null && i2 != null) return min(i1.intValue(), i2.intValue()); return null; } /** * Returns the smaller value of the two int arguments. * * @param i1 the first int. * @param i2 the second int. * @return the smaller value of the two int arguments. */ public static int min(int i1, int i2) { return i1 < i2 ? i1 : i2; } /** * Returns the smaller of the two Doubles. A null Double * is treated as smaller then {@link Double#MIN_VALUE}. * * @param d1 the first Double. * @param d2 the second Double. * @return the smaller of the two Doubles. */ public static Double min(Double d1, Double d2) { if (d1 != null && d2 != null) return min(d1.doubleValue(), d2.doubleValue()); return null; } /** * Returns the smaller value of the two double arguments. * * @param d1 the first double. * @param d2 the second double. * @return the smaller value of the two double arguments. */ public static double min(double d1, double d2) { return d1 < d2 ? d1 : d2; } }