Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 4773 invoked from network); 3 Feb 2010 07:54:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Feb 2010 07:54:14 -0000 Received: (qmail 55153 invoked by uid 500); 3 Feb 2010 07:54:14 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 55050 invoked by uid 500); 3 Feb 2010 07:54:13 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 55040 invoked by uid 99); 3 Feb 2010 07:54:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 07:54:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 07:54:12 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D101C23889F7; Wed, 3 Feb 2010 07:53:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r905925 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/ArrayUtils.java test/java/org/apache/commons/lang3/ArrayUtilsTest.java Date: Wed, 03 Feb 2010 07:53:50 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100203075351.D101C23889F7@eris.apache.org> Author: bayard Date: Wed Feb 3 07:53:47 2010 New Revision: 905925 URL: http://svn.apache.org/viewvc?rev=905925&view=rev Log: Adding nullToEmpty methods to ArrayUtils per LANG-534 and Levon Karayan's patch. Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java?rev=905925&r1=905924&r2=905925&view=diff ============================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java Wed Feb 3 07:53:47 2010 @@ -43,6 +43,7 @@ * @author Gary Gregory * @author Ashwin S * @author Maarten Coene + * @author Levon Karayan * @since 2.0 * @version $Id$ */ @@ -441,6 +442,387 @@ return array.clone(); } + // nullToEmpty + //----------------------------------------------------------------------- + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Object[] nullToEmpty(Object[] array) { + if (array == null) { + return EMPTY_OBJECT_ARRAY; + } else if (array.length == 0) { + return EMPTY_OBJECT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static String[] nullToEmpty(String[] array) { + if (array == null) { + return EMPTY_STRING_ARRAY; + } else if (array.length == 0) { + return EMPTY_STRING_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static long[] nullToEmpty(long[] array) { + if (array == null) { + return EMPTY_LONG_ARRAY; + } + if (array.length == 0) { + return EMPTY_LONG_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static int[] nullToEmpty(int[] array) { + if (array == null) { + return EMPTY_INT_ARRAY; + } else if (array.length == 0) { + return EMPTY_INT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static short[] nullToEmpty(short[] array) { + if (array == null) { + return EMPTY_SHORT_ARRAY; + } else if (array.length == 0) { + return EMPTY_SHORT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static char[] nullToEmpty(char[] array) { + if (array == null) { + return EMPTY_CHAR_ARRAY; + } else if (array.length == 0) { + return EMPTY_CHAR_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static byte[] nullToEmpty(byte[] array) { + if (array == null) { + return EMPTY_BYTE_ARRAY; + } else if (array.length == 0) { + return EMPTY_BYTE_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static double[] nullToEmpty(double[] array) { + if (array == null) { + return EMPTY_DOUBLE_ARRAY; + } else if (array.length == 0) { + return EMPTY_DOUBLE_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static float[] nullToEmpty(float[] array) { + if (array == null) { + return EMPTY_FLOAT_ARRAY; + } else if (array.length == 0) { + return EMPTY_FLOAT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static boolean[] nullToEmpty(boolean[] array) { + if (array == null) { + return EMPTY_BOOLEAN_ARRAY; + } else if (array.length == 0) { + return EMPTY_BOOLEAN_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Long[] nullToEmpty(Long[] array) { + if (array == null) { + return EMPTY_LONG_OBJECT_ARRAY; + } else if (array.length == 0) { + return EMPTY_LONG_OBJECT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Integer[] nullToEmpty(Integer[] array) { + if (array == null) { + return EMPTY_INTEGER_OBJECT_ARRAY; + } else if (array.length == 0) { + return EMPTY_INTEGER_OBJECT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Short[] nullToEmpty(Short[] array) { + if (array == null) { + return EMPTY_SHORT_OBJECT_ARRAY; + }else if (array.length == 0) { + return EMPTY_SHORT_OBJECT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Character[] nullToEmpty(Character[] array) { + if (array == null) { + return EMPTY_CHARACTER_OBJECT_ARRAY; + } else if (array.length == 0) { + return EMPTY_CHARACTER_OBJECT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Byte[] nullToEmpty(Byte[] array) { + if (array == null) { + return EMPTY_BYTE_OBJECT_ARRAY; + } else if (array.length == 0) { + return EMPTY_BYTE_OBJECT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Double[] nullToEmpty(Double[] array) { + if (array == null) { + return EMPTY_DOUBLE_OBJECT_ARRAY; + } else if (array.length == 0) { + return EMPTY_DOUBLE_OBJECT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Float[] nullToEmpty(Float[] array) { + if (array == null) { + return EMPTY_FLOAT_OBJECT_ARRAY; + } else if (array.length == 0) { + return EMPTY_FLOAT_OBJECT_ARRAY; + } + return array; + } + + /** + *

Defensive programming technique to change a null + * reference to an empty one..

+ * + *

This method returns an empty array for a null input array.

+ * + *

As a memory optimizing technique an empty array passed in will be overridden with + * the empty public static references in this class.

+ * + * @param array the array to check for null or empty + * @return the same array, public static empty array if null or empty input + */ + public static Boolean[] nullToEmpty(Boolean[] array) { + if (array == null) { + return EMPTY_BOOLEAN_OBJECT_ARRAY; + } else if (array.length == 0) { + return EMPTY_BOOLEAN_OBJECT_ARRAY; + } + return array; + } + // Subarrays //----------------------------------------------------------------------- /** Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java?rev=905925&r1=905924&r2=905925&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java Wed Feb 3 07:53:47 2010 @@ -36,6 +36,7 @@ * @author Fredrik Westermarck * @author Gary Gregory * @author Maarten Coene + * @author Levon Karayan * @version $Id$ */ public class ArrayUtilsTest extends TestCase { @@ -325,6 +326,242 @@ //----------------------------------------------------------------------- + public void testNullToEmptyBoolean() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_BOOLEAN_ARRAY, ArrayUtils.nullToEmpty((boolean[]) null)); + // Test valid array handling + boolean[] original = new boolean[] {true, false}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + boolean[] empty = new boolean[]{}; + boolean[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_BOOLEAN_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyLong() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_LONG_ARRAY, ArrayUtils.nullToEmpty((long[]) null)); + // Test valid array handling + long[] original = new long[] {1L, 2L}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + long[] empty = new long[]{}; + long[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_LONG_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyInt() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_INT_ARRAY, ArrayUtils.nullToEmpty((int[]) null)); + // Test valid array handling + int[] original = new int[] {1, 2}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + int[] empty = new int[]{}; + int[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_INT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyShort() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_SHORT_ARRAY, ArrayUtils.nullToEmpty((short[]) null)); + // Test valid array handling + short[] original = new short[] {1, 2}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + short[] empty = new short[]{}; + short[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_SHORT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyChar() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_CHAR_ARRAY, ArrayUtils.nullToEmpty((char[]) null)); + // Test valid array handling + char[] original = new char[] {'a', 'b'}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + char[] empty = new char[]{}; + char[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_CHAR_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyByte() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.nullToEmpty((byte[]) null)); + // Test valid array handling + byte[] original = new byte[] {0x0F, 0x0E}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + byte[] empty = new byte[]{}; + byte[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_BYTE_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyDouble() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_DOUBLE_ARRAY, ArrayUtils.nullToEmpty((double[]) null)); + // Test valid array handling + double[] original = new double[] {1L, 2L}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + double[] empty = new double[]{}; + double[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_DOUBLE_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyFloat() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_FLOAT_ARRAY, ArrayUtils.nullToEmpty((float[]) null)); + // Test valid array handling + float[] original = new float[] {2.6f, 3.8f}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + float[] empty = new float[]{}; + float[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_FLOAT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Object[]) null)); + // Test valid array handling + Object[] original = new Object[] {true, false}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Object[] empty = new Object[]{}; + Object[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyString() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_STRING_ARRAY, ArrayUtils.nullToEmpty((String[]) null)); + // Test valid array handling + String[] original = new String[] {"abc", "def"}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + String[] empty = new String[]{}; + String[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_STRING_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyBooleanObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Boolean[]) null)); + // Test valid array handling + Boolean[] original = new Boolean[] {Boolean.TRUE, Boolean.FALSE}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Boolean[] empty = new Boolean[]{}; + Boolean[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_BOOLEAN_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyLongObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_LONG_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Long[]) null)); + // Test valid array handling + Long[] original = new Long[] {1L, 2L}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Long[] empty = new Long[]{}; + Long[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_LONG_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyIntObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Integer[]) null)); + // Test valid array handling + Integer[] original = new Integer[] {1, 2}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Integer[] empty = new Integer[]{}; + Integer[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyShortObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_SHORT_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Short[]) null)); + // Test valid array handling + Short[] original = new Short[] {1, 2}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Short[] empty = new Short[]{}; + Short[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_SHORT_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyCharObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Character[]) null)); + // Test valid array handling + Character[] original = new Character[] {'a', 'b'}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Character[] empty = new Character[]{}; + Character[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_CHARACTER_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyByteObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_BYTE_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Byte[]) null)); + // Test valid array handling + Byte[] original = new Byte[] {0x0F, 0x0E}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Byte[] empty = new Byte[]{}; + Byte[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_BYTE_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyDoubleObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_DOUBLE_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Double[]) null)); + // Test valid array handling + Double[] original = new Double[] {1D, 2D}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Double[] empty = new Double[]{}; + Double[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_DOUBLE_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + public void testNullToEmptyFloatObject() { + // Test null handling + assertEquals(ArrayUtils.EMPTY_FLOAT_OBJECT_ARRAY, ArrayUtils.nullToEmpty((Float[]) null)); + // Test valid array handling + Float[] original = new Float[] {2.6f, 3.8f}; + assertEquals(original, ArrayUtils.nullToEmpty(original)); + // Test empty array handling + Float[] empty = new Float[]{}; + Float[] result = ArrayUtils.nullToEmpty(empty); + assertEquals(ArrayUtils.EMPTY_FLOAT_OBJECT_ARRAY, result); + assertTrue(empty != result); + } + + //----------------------------------------------------------------------- + public void testSubarrayObject() { Object[] nullArray = null; Object[] objectArray = { "a", "b", "c", "d", "e", "f"};