LANG-1008: Change min/max methods in NumberUtils/IEEE754rUtils from array input parameters to varargs. This also closes #23 from github. Thanks to Thiago Andrade.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1593118 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benedikt Ritter 2014-05-07 19:05:39 +00:00
parent 10f136bb01
commit 3728344459
3 changed files with 33 additions and 16 deletions

View File

@ -22,6 +22,7 @@
<body>
<release version="3.4" date="tba" description="tba">
<action issue="LANG-1008" type="update" dev="britter" due-to="Thiago Andrade">Change min/max methods in NumberUtils/IEEE754rUtils from array input parameters to varargs</action>
<action issue="LANG-999" type="add" dev="britter" due-to="Ben Ripkens">Add fuzzy String matching logic to StringUtils</action>
<action issue="LANG-1006" type="update" dev="britter" due-to="Thiago Andrade">Add wrap (with String or char) to StringUtils</action>
<action issue="LANG-1005" type="update" dev="britter" due-to="Michael Osipov">Extend DurationFormatUtils#formatDurationISO default pattern to match #formatDurationHMS</action>

View File

@ -33,8 +33,9 @@ public class IEEE754rUtils {
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from min(double[]) to min(double...)
*/
public static double min(final double[] array) {
public static double min(final double... array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
@ -58,8 +59,9 @@ public static double min(final double[] array) {
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from min(float[]) to min(float...)
*/
public static float min(final float[] array) {
public static float min(final float... array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
@ -151,8 +153,9 @@ public static float min(final float a, final float b) {
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from max(double[]) to max(double...)
*/
public static double max(final double[] array) {
public static double max(final double... array) {
// Validates input
if (array== null) {
throw new IllegalArgumentException("The Array must not be null");
@ -176,8 +179,9 @@ public static double max(final double[] array) {
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from max(float[]) to max(float...)
*/
public static float max(final float[] array) {
public static float max(final float... array) {
// Validates input
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");

View File

@ -784,8 +784,9 @@ public static BigDecimal createBigDecimal(final String str) {
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from min(long[]) to min(long...)
*/
public static long min(final long[] array) {
public static long min(final long... array) {
// Validates input
validateArray(array);
@ -807,8 +808,9 @@ public static long min(final long[] array) {
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from min(int[]) to min(int...)
*/
public static int min(final int[] array) {
public static int min(final int... array) {
// Validates input
validateArray(array);
@ -830,8 +832,9 @@ public static int min(final int[] array) {
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from min(short[]) to min(short...)
*/
public static short min(final short[] array) {
public static short min(final short... array) {
// Validates input
validateArray(array);
@ -853,8 +856,9 @@ public static short min(final short[] array) {
* @return the minimum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from min(byte[]) to min(byte...)
*/
public static byte min(final byte[] array) {
public static byte min(final byte... array) {
// Validates input
validateArray(array);
@ -877,8 +881,9 @@ public static byte min(final byte[] array) {
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @see IEEE754rUtils#min(double[]) IEEE754rUtils for a version of this method that handles NaN differently
* @since 3.4 Changed signature from min(double[]) to min(double...)
*/
public static double min(final double[] array) {
public static double min(final double... array) {
// Validates input
validateArray(array);
@ -904,8 +909,9 @@ public static double min(final double[] array) {
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @see IEEE754rUtils#min(float[]) IEEE754rUtils for a version of this method that handles NaN differently
* @since 3.4 Changed signature from min(float[]) to min(float...)
*/
public static float min(final float[] array) {
public static float min(final float... array) {
// Validates input
validateArray(array);
@ -932,8 +938,9 @@ public static float min(final float[] array) {
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from max(long[]) to max(long...)
*/
public static long max(final long[] array) {
public static long max(final long... array) {
// Validates input
validateArray(array);
@ -955,8 +962,9 @@ public static long max(final long[] array) {
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from max(int[]) to max(int...)
*/
public static int max(final int[] array) {
public static int max(final int... array) {
// Validates input
validateArray(array);
@ -978,8 +986,9 @@ public static int max(final int[] array) {
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from max(short[]) to max(short...)
*/
public static short max(final short[] array) {
public static short max(final short... array) {
// Validates input
validateArray(array);
@ -1001,8 +1010,9 @@ public static short max(final short[] array) {
* @return the maximum value in the array
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @since 3.4 Changed signature from max(byte[]) to max(byte...)
*/
public static byte max(final byte[] array) {
public static byte max(final byte... array) {
// Validates input
validateArray(array);
@ -1025,8 +1035,9 @@ public static byte max(final byte[] array) {
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @see IEEE754rUtils#max(double[]) IEEE754rUtils for a version of this method that handles NaN differently
* @since 3.4 Changed signature from max(double[]) to max(double...)
*/
public static double max(final double[] array) {
public static double max(final double... array) {
// Validates input
validateArray(array);
@ -1052,8 +1063,9 @@ public static double max(final double[] array) {
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
* @throws IllegalArgumentException if <code>array</code> is empty
* @see IEEE754rUtils#max(float[]) IEEE754rUtils for a version of this method that handles NaN differently
* @since 3.4 Changed signature from max(float[]) to max(float...)
*/
public static float max(final float[] array) {
public static float max(final float... array) {
// Validates input
validateArray(array);