You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/09/11 18:56:07 UTC
svn commit: r1760274 [2/3] - in /sis/branches/JDK8:
core/sis-referencing/src/main/java/org/apache/sis/parameter/
core/sis-utility/src/main/java/org/apache/sis/internal/converter/
core/sis-utility/src/main/java/org/apache/sis/io/ core/sis-utility/src/ma...
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java?rev=1760274&r1=1760273&r2=1760274&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java [UTF-8] Sun Sep 11 18:56:07 2016
@@ -153,12 +153,12 @@ public final class ArraysExt extends Sta
* Note that if the given array is {@code null}, then this method unconditionally returns
* {@code null} no matter the value of the {@code length} argument.
*
- * @param <E> The array elements.
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param <E> the array elements.
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(Object[], int)
*/
@@ -169,15 +169,14 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements as the given {@code array} but
* specified {@code length}, truncating or padding with zeros if necessary.
+ * This method returns {@code null} if and only if the given array is {@code null},
+ * in which case the value of the {@code length} argument is ignored.
*
- * <p>This method returns {@code null} if and only if the given array is {@code null},
- * in which case the value of the {@code length} argument is ignored.</p>
- *
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(double[], int)
*/
@@ -196,15 +195,14 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements as the given {@code array} but
* specified {@code length}, truncating or padding with zeros if necessary.
+ * This method returns {@code null} if and only if the given array is {@code null},
+ * in which case the value of the {@code length} argument is ignored.
*
- * <p>This method returns {@code null} if and only if the given array is {@code null},
- * in which case the value of the {@code length} argument is ignored.</p>
- *
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(float[], int)
*/
@@ -223,15 +221,14 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements as the given {@code array} but
* specified {@code length}, truncating or padding with zeros if necessary.
+ * This method returns {@code null} if and only if the given array is {@code null},
+ * in which case the value of the {@code length} argument is ignored.
*
- * <p>This method returns {@code null} if and only if the given array is {@code null},
- * in which case the value of the {@code length} argument is ignored.</p>
- *
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(long[], int)
*/
@@ -250,15 +247,14 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements as the given {@code array} but
* specified {@code length}, truncating or padding with zeros if necessary.
+ * This method returns {@code null} if and only if the given array is {@code null},
+ * in which case the value of the {@code length} argument is ignored.
*
- * <p>This method returns {@code null} if and only if the given array is {@code null},
- * in which case the value of the {@code length} argument is ignored.</p>
- *
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(int[], int)
*/
@@ -277,15 +273,14 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements as the given {@code array} but
* specified {@code length}, truncating or padding with zeros if necessary.
+ * This method returns {@code null} if and only if the given array is {@code null},
+ * in which case the value of the {@code length} argument is ignored.
*
- * <p>This method returns {@code null} if and only if the given array is {@code null},
- * in which case the value of the {@code length} argument is ignored.</p>
- *
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(short[], int)
*/
@@ -304,15 +299,14 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements as the given {@code array} but
* specified {@code length}, truncating or padding with zeros if necessary.
+ * This method returns {@code null} if and only if the given array is {@code null},
+ * in which case the value of the {@code length} argument is ignored.
*
- * <p>This method returns {@code null} if and only if the given array is {@code null},
- * in which case the value of the {@code length} argument is ignored.</p>
- *
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(byte[], int)
*/
@@ -331,15 +325,14 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements as the given {@code array} but
* specified {@code length}, truncating or padding with zeros if necessary.
+ * This method returns {@code null} if and only if the given array is {@code null},
+ * in which case the value of the {@code length} argument is ignored.
*
- * <p>This method returns {@code null} if and only if the given array is {@code null},
- * in which case the value of the {@code length} argument is ignored.</p>
- *
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(char[], int)
*/
@@ -358,15 +351,14 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements as the given {@code array} but
* specified {@code length}, truncating or padding with {@code false} if necessary.
+ * This method returns {@code null} if and only if the given array is {@code null},
+ * in which case the value of the {@code length} argument is ignored.
*
- * <p>This method returns {@code null} if and only if the given array is {@code null},
- * in which case the value of the {@code length} argument is ignored.</p>
- *
- * @param array Array to resize, or {@code null}.
- * @param length Length of the desired array.
- * @return A new array of the requested length, or {@code array} if the given
+ * @param array array to resize, or {@code null}.
+ * @param length length of the desired array.
+ * @return a new array of the requested length, or {@code array} if the given
* array is {@code null} or already have the requested length.
- * @throws NegativeArraySizeException If {@code length} is negative.
+ * @throws NegativeArraySizeException if {@code length} is negative.
*
* @see Arrays#copyOf(boolean[], int)
*/
@@ -383,29 +375,26 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array.
- * In every cases, the given array is never modified.</p>
- *
- * @param <T> The array type.
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param <T> the array type.
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*/
@SuppressWarnings("SuspiciousSystemArraycopy")
private static <T> T doRemove(final T array, final int first, final int length)
throws NullArgumentException, IllegalArgumentException, IndexOutOfBoundsException
{
if (length == 0) {
- return array; // May be null
+ return array; // May be null
}
ArgumentChecks.ensureNonNull ("array", array);
ArgumentChecks.ensurePositive("length", length);
@@ -418,22 +407,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns
- * the {@code array} reference unchanged (except if empty). Otherwise this method
- * creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param <E> The type of array elements.
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param <E> the type of array elements.
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(Object[], int, int)
*/
@@ -444,21 +430,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged, except for {@linkplain #EMPTY_DOUBLE empty} arrays. Otherwise
- * this method creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged,
+ * except for {@linkplain #EMPTY_DOUBLE empty} arrays. Otherwise this method creates a new array.
+ * In every cases, the given array is never modified.
+ *
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(double[], int, int)
*/
@@ -470,21 +454,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged, except for {@linkplain #EMPTY_FLOAT empty} arrays. Otherwise
- * this method creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged,
+ * except for {@linkplain #EMPTY_FLOAT empty} arrays. Otherwise this method creates a new array.
+ * In every cases, the given array is never modified.
+ *
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(float[], int, int)
*/
@@ -496,21 +478,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged, except for {@linkplain #EMPTY_LONG empty} arrays. Otherwise
- * this method creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged,
+ * except for {@linkplain #EMPTY_LONG empty} arrays. Otherwise this method creates a new array.
+ * In every cases, the given array is never modified.
+ *
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(long[], int, int)
*/
@@ -522,21 +502,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged, except for {@linkplain #EMPTY_INT empty} arrays. Otherwise
- * this method creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged,
+ * except for {@linkplain #EMPTY_INT empty} arrays. Otherwise this method creates a new array.
+ * In every cases, the given array is never modified.
+ *
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(int[], int, int)
*/
@@ -548,21 +526,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged, except for {@linkplain #EMPTY_SHORT empty} arrays. Otherwise
- * this method creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged,
+ * except for {@linkplain #EMPTY_SHORT empty} arrays. Otherwise this method creates a new array.
+ * In every cases, the given array is never modified.
+ *
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(short[], int, int)
*/
@@ -574,21 +550,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged, except for {@linkplain #EMPTY_BYTE empty} arrays. Otherwise
- * this method creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged,
+ * except for {@linkplain #EMPTY_BYTE empty} arrays. Otherwise this method creates a new array.
+ * In every cases, the given array is never modified.
+ *
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(byte[], int, int)
*/
@@ -600,21 +574,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged, except for {@linkplain #EMPTY_CHAR empty} arrays. Otherwise
- * this method creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged,
+ * except for {@linkplain #EMPTY_CHAR empty} arrays. Otherwise this method creates a new array.
+ * In every cases, the given array is never modified.
+ *
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(char[], int, int)
*/
@@ -626,21 +598,19 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array except for
- * the given range.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged, except for {@linkplain #EMPTY_BOOLEAN empty} arrays. Otherwise
- * this method creates a new array. In every cases, the given array is never modified.</p>
- *
- * @param array Array from which to remove elements. Can be {@code null} only if {@code length} is 0.
- * @param first Index of the first element to remove from the given {@code array}.
- * @param length Number of elements to remove.
- * @return Array with the same elements than the given {@code array} except for the
- * removed elements, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array except for the given range.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged,
+ * except for {@linkplain #EMPTY_BOOLEAN empty} arrays. Otherwise this method creates a new array.
+ * In every cases, the given array is never modified.
+ *
+ * @param array array from which to remove elements. Can be {@code null} only if {@code length} is 0.
+ * @param first index of the first element to remove from the given {@code array}.
+ * @param length number of elements to remove.
+ * @return array with the same elements than the given {@code array} except for the removed elements,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(boolean[], int, int)
*/
@@ -654,28 +624,26 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements than the given array, with additional
* "spaces" in the given range. These "spaces" will be made up of {@code null} elements.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
*
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param <T> The array type.
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * @param <T> the array type.
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*/
@SuppressWarnings("SuspiciousSystemArraycopy")
private static <T> T doInsert(final T array, final int first, final int length)
throws NullArgumentException, IllegalArgumentException, IndexOutOfBoundsException
{
if (length == 0) {
- return array; // May be null
+ return array; // May be null
}
ArgumentChecks.ensureNonNull ("array", array);
ArgumentChecks.ensurePositive("length", length);
@@ -690,21 +658,19 @@ public final class ArraysExt extends Sta
/**
* Returns an array containing the same elements than the given array, with additional
* "spaces" in the given range. These "spaces" will be made up of {@code null} elements.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
*
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param <E> The type of array elements.
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * @param <E> the type of array elements.
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(Object[], int, Object[], int, int)
* @see #remove(Object[], int, int)
@@ -716,23 +682,20 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with additional
- * "spaces" in the given range. These "spaces" will be made up of elements initialized
- * to zero.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array, with additional "spaces"
+ * in the given range. These "spaces" will be made up of elements initialized to zero.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(double[], int, double[], int, int)
* @see #remove(double[], int, int)
@@ -744,23 +707,20 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with additional
- * "spaces" in the given range. These "spaces" will be made up of elements initialized
- * to zero.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array, with additional "spaces"
+ * in the given range. These "spaces" will be made up of elements initialized to zero.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(float[], int, float[], int, int)
* @see #remove(float[], int, int)
@@ -772,23 +732,20 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with additional
- * "spaces" in the given range. These "spaces" will be made up of elements initialized
- * to zero.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array, with additional "spaces"
+ * in the given range. These "spaces" will be made up of elements initialized to zero.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(long[], int, long[], int, int)
* @see #remove(long[], int, int)
@@ -800,23 +757,20 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with additional
- * "spaces" in the given range. These "spaces" will be made up of elements initialized
- * to zero.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array, with additional "spaces"
+ * in the given range. These "spaces" will be made up of elements initialized to zero.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(int[], int, int[], int, int)
* @see #remove(int[], int, int)
@@ -828,23 +782,20 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with additional
- * "spaces" in the given range. These "spaces" will be made up of elements initialized
- * to zero.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array, with additional "spaces"
+ * in the given range. These "spaces" will be made up of elements initialized to zero.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(short[], int, short[], int, int)
* @see #remove(short[], int, int)
@@ -856,23 +807,20 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with additional
- * "spaces" in the given range. These "spaces" will be made up of elements initialized
- * to zero.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array, with additional "spaces"
+ * in the given range. These "spaces" will be made up of elements initialized to zero.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(byte[], int, byte[], int, int)
* @see #remove(byte[], int, int)
@@ -884,23 +832,20 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with additional
- * "spaces" in the given range. These "spaces" will be made up of elements initialized
- * to zero.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array, with additional "spaces"
+ * in the given range. These "spaces" will be made up of elements initialized to zero.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(char[], int, char[], int, int)
* @see #remove(char[], int, int)
@@ -912,23 +857,20 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with additional
- * "spaces" in the given range. These "spaces" will be made up of elements initialized
- * to {@code false}.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code array}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given array is never modified.</p>
- *
- * @param array Array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
- * @param first Index where the first space should be inserted. All {@code array} elements
- * having an index equal to or higher than {@code index} will be moved forward.
- * @param length Number of spaces to insert.
- * @return Array containing the {@code array} elements with the additional space
- * inserted, or {@code array} (which may be null) if {@code length} is 0.
- * @throws NullArgumentException If {@code array} is null and {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code first} or {@code first+length} is out of array bounds.
+ * Returns an array containing the same elements than the given array, with additional "spaces"
+ * in the given range. These "spaces" will be made up of elements initialized to {@code false}.
+ * If the {@code length} argument is 0, then this method returns the {@code array} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given array is never modified.
+ *
+ * @param array array in which to insert spaces. Can be {@code null} only if {@code length} is 0.
+ * @param first index where the first space should be inserted. All {@code array} elements
+ * having an index equal to or higher than {@code index} will be moved forward.
+ * @param length number of spaces to insert.
+ * @return array containing the {@code array} elements with the additional space inserted,
+ * or {@code array} (which may be null) if {@code length} is 0.
+ * @throws NullArgumentException if {@code array} is null and {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code first} or {@code first+length} is out of array bounds.
*
* @see #insert(boolean[], int, boolean[], int, int)
* @see #remove(boolean[], int, int)
@@ -940,29 +882,24 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with the content
- * of an other array inserted at the given index.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code dst}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given arrays are never modified.</p>
- *
- * @param <T> The arrays type.
- * @param src Array to entirely or partially insert into {@code dst}.
- * Can be null only if {@code length} is 0.
- * @param srcOff Index of the first element of {@code src} to insert into {@code dst}.
- * @param dst Array in which to insert {@code src} data.
- * Can be null only if {@code length} is 0.
- * @param dstOff Index of the first element in {@code dst} where to insert {@code src} data.
- * All elements of {@code dst} whose index is equal to or greater than
- * {@code dstOff} will be moved forward.
- * @param length Number of {@code src} elements to insert.
- * @return Array which contains the merge of {@code src} and {@code dst}. This method
- * returns directly {@code dst} when {@code length} is zero, but never return
- * {@code src}.
- * @throws NullArgumentException If {@code src} or {@code dst} is null while {@code length} is different than 0.
- * @throws IllegalArgumentException If {@code length} is negative.
- * @throws IndexOutOfBoundsException If {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds,
+ * Returns an array containing the same elements than the given array,
+ * with the content of an other array inserted at the given index.
+ * If the {@code length} argument is 0, then this method returns the {@code dst} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given arrays are never modified.
+ *
+ * @param <T> the arrays type.
+ * @param src array to entirely or partially insert into {@code dst}. Can be null only if {@code length} is 0.
+ * @param srcOff index of the first element of {@code src} to insert into {@code dst}.
+ * @param dst array in which to insert {@code src} data. Can be null only if {@code length} is 0.
+ * @param dstOff index of the first element in {@code dst} where to insert {@code src} data.
+ * All elements of {@code dst} whose index is equal to or greater than {@code dstOff}
+ * will be moved forward.
+ * @param length number of {@code src} elements to insert.
+ * @return array which contains the merge of {@code src} and {@code dst}.
+ * This method returns directly {@code dst} when {@code length} is zero, but never return {@code src}.
+ * @throws NullArgumentException if {@code src} or {@code dst} is null while {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds.
*/
@SuppressWarnings("SuspiciousSystemArraycopy")
private static <T> T doInsert(final T src, final int srcOff,
@@ -970,7 +907,7 @@ public final class ArraysExt extends Sta
throws NullArgumentException, IllegalArgumentException, IndexOutOfBoundsException
{
if (length == 0) {
- return dst; // May be null
+ return dst; // May be null
}
ArgumentChecks.ensureNonNull("src", src);
ArgumentChecks.ensureNonNull("dst", dst);
@@ -985,32 +922,24 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with the content
- * of an other array inserted at the given index.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code dst}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given arrays are never modified.</p>
- *
- * @param <E> The type of array elements.
- * @param src Array to entirely or partially insert into {@code dst}.
- * Can be null only if {@code length} is 0.
- * @param srcOff Index of the first element of {@code src} to insert into {@code dst}.
- * @param dst Array in which to insert {@code src} data.
- * Can be null only if {@code length} is 0.
- * @param dstOff Index of the first element in {@code dst} where to insert {@code src} data.
- * All elements of {@code dst} whose index is equal to or greater than
- * {@code dstOff} will be moved forward.
- * @param length Number of {@code src} elements to insert.
- * @return Array which contains the merge of {@code src} and {@code dst}. This method
- * returns directly {@code dst} when {@code length} is zero, but never return
- * {@code src}.
- * @throws NullArgumentException
- * If {@code src} or {@code dst} is null while {@code length} is different than 0.
- * @throws IllegalArgumentException
- * If {@code length} is negative.
- * @throws IndexOutOfBoundsException
- * If {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds,
+ * Returns an array containing the same elements than the given array,
+ * with the content of an other array inserted at the given index.
+ * If the {@code length} argument is 0, then this method returns the {@code dst} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given arrays are never modified.
+ *
+ * @param <E> the type of array elements.
+ * @param src array to entirely or partially insert into {@code dst}. Can be null only if {@code length} is 0.
+ * @param srcOff index of the first element of {@code src} to insert into {@code dst}.
+ * @param dst array in which to insert {@code src} data. Can be null only if {@code length} is 0.
+ * @param dstOff index of the first element in {@code dst} where to insert {@code src} data.
+ * All elements of {@code dst} whose index is equal to or greater than {@code dstOff}
+ * will be moved forward.
+ * @param length number of {@code src} elements to insert.
+ * @return array which contains the merge of {@code src} and {@code dst}.
+ * This method returns directly {@code dst} when {@code length} is zero, but never return {@code src}.
+ * @throws NullArgumentException if {@code src} or {@code dst} is null while {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds.
*/
public static <E> E[] insert(final E[] src, final int srcOff,
final E[] dst, final int dstOff, final int length)
@@ -1020,31 +949,23 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with the content
- * of an other array inserted at the given index.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code dst}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given arrays are never modified.</p>
- *
- * @param src Array to entirely or partially insert into {@code dst}.
- * Can be null only if {@code length} is 0.
- * @param srcOff Index of the first element of {@code src} to insert into {@code dst}.
- * @param dst Array in which to insert {@code src} data.
- * Can be null only if {@code length} is 0.
- * @param dstOff Index of the first element in {@code dst} where to insert {@code src} data.
- * All elements of {@code dst} whose index is equal to or greater than
- * {@code dstOff} will be moved forward.
- * @param length Number of {@code src} elements to insert.
- * @return Array which contains the merge of {@code src} and {@code dst}. This method
- * returns directly {@code dst} when {@code length} is zero, but never return
- * {@code src}.
- * @throws NullArgumentException
- * If {@code src} or {@code dst} is null while {@code length} is different than 0.
- * @throws IllegalArgumentException
- * If {@code length} is negative.
- * @throws IndexOutOfBoundsException
- * If {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds,
+ * Returns an array containing the same elements than the given array,
+ * with the content of an other array inserted at the given index.
+ * If the {@code length} argument is 0, then this method returns the {@code dst} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given arrays are never modified.
+ *
+ * @param src array to entirely or partially insert into {@code dst}. Can be null only if {@code length} is 0.
+ * @param srcOff index of the first element of {@code src} to insert into {@code dst}.
+ * @param dst array in which to insert {@code src} data. Can be null only if {@code length} is 0.
+ * @param dstOff index of the first element in {@code dst} where to insert {@code src} data.
+ * All elements of {@code dst} whose index is equal to or greater than {@code dstOff}
+ * will be moved forward.
+ * @param length number of {@code src} elements to insert.
+ * @return array which contains the merge of {@code src} and {@code dst}.
+ * This method returns directly {@code dst} when {@code length} is zero, but never return {@code src}.
+ * @throws NullArgumentException if {@code src} or {@code dst} is null while {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds.
*/
public static double[] insert(final double[] src, final int srcOff,
final double[] dst, final int dstOff, final int length)
@@ -1054,31 +975,23 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with the content
- * of an other array inserted at the given index.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code dst}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given arrays are never modified.</p>
- *
- * @param src Array to entirely or partially insert into {@code dst}.
- * Can be null only if {@code length} is 0.
- * @param srcOff Index of the first element of {@code src} to insert into {@code dst}.
- * @param dst Array in which to insert {@code src} data.
- * Can be null only if {@code length} is 0.
- * @param dstOff Index of the first element in {@code dst} where to insert {@code src} data.
- * All elements of {@code dst} whose index is equal to or greater than
- * {@code dstOff} will be moved forward.
- * @param length Number of {@code src} elements to insert.
- * @return Array which contains the merge of {@code src} and {@code dst}. This method
- * returns directly {@code dst} when {@code length} is zero, but never return
- * {@code src}.
- * @throws NullArgumentException
- * If {@code src} or {@code dst} is null while {@code length} is different than 0.
- * @throws IllegalArgumentException
- * If {@code length} is negative.
- * @throws IndexOutOfBoundsException
- * If {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds,
+ * Returns an array containing the same elements than the given array,
+ * with the content of an other array inserted at the given index.
+ * If the {@code length} argument is 0, then this method returns the {@code dst} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given arrays are never modified.
+ *
+ * @param src array to entirely or partially insert into {@code dst}. Can be null only if {@code length} is 0.
+ * @param srcOff index of the first element of {@code src} to insert into {@code dst}.
+ * @param dst array in which to insert {@code src} data. Can be null only if {@code length} is 0.
+ * @param dstOff index of the first element in {@code dst} where to insert {@code src} data.
+ * All elements of {@code dst} whose index is equal to or greater than {@code dstOff}
+ * will be moved forward.
+ * @param length number of {@code src} elements to insert.
+ * @return array which contains the merge of {@code src} and {@code dst}.
+ * This method returns directly {@code dst} when {@code length} is zero, but never return {@code src}.
+ * @throws NullArgumentException if {@code src} or {@code dst} is null while {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds.
*/
public static float[] insert(final float[] src, final int srcOff,
final float[] dst, final int dstOff, final int length)
@@ -1088,31 +1001,23 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with the content
- * of an other array inserted at the given index.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code dst}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given arrays are never modified.</p>
- *
- * @param src Array to entirely or partially insert into {@code dst}.
- * Can be null only if {@code length} is 0.
- * @param srcOff Index of the first element of {@code src} to insert into {@code dst}.
- * @param dst Array in which to insert {@code src} data.
- * Can be null only if {@code length} is 0.
- * @param dstOff Index of the first element in {@code dst} where to insert {@code src} data.
- * All elements of {@code dst} whose index is equal to or greater than
- * {@code dstOff} will be moved forward.
- * @param length Number of {@code src} elements to insert.
- * @return Array which contains the merge of {@code src} and {@code dst}. This method
- * returns directly {@code dst} when {@code length} is zero, but never return
- * {@code src}.
- * @throws NullArgumentException
- * If {@code src} or {@code dst} is null while {@code length} is different than 0.
- * @throws IllegalArgumentException
- * If {@code length} is negative.
- * @throws IndexOutOfBoundsException
- * If {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds,
+ * Returns an array containing the same elements than the given array,
+ * with the content of an other array inserted at the given index.
+ * If the {@code length} argument is 0, then this method returns the {@code dst} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given arrays are never modified.
+ *
+ * @param src array to entirely or partially insert into {@code dst}. Can be null only if {@code length} is 0.
+ * @param srcOff index of the first element of {@code src} to insert into {@code dst}.
+ * @param dst array in which to insert {@code src} data. Can be null only if {@code length} is 0.
+ * @param dstOff index of the first element in {@code dst} where to insert {@code src} data.
+ * All elements of {@code dst} whose index is equal to or greater than {@code dstOff}
+ * will be moved forward.
+ * @param length number of {@code src} elements to insert.
+ * @return array which contains the merge of {@code src} and {@code dst}.
+ * This method returns directly {@code dst} when {@code length} is zero, but never return {@code src}.
+ * @throws NullArgumentException if {@code src} or {@code dst} is null while {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds.
*/
public static long[] insert(final long[] src, final int srcOff,
final long[] dst, final int dstOff, final int length)
@@ -1122,31 +1027,23 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with the content
- * of an other array inserted at the given index.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code dst}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given arrays are never modified.</p>
- *
- * @param src Array to entirely or partially insert into {@code dst}.
- * Can be null only if {@code length} is 0.
- * @param srcOff Index of the first element of {@code src} to insert into {@code dst}.
- * @param dst Array in which to insert {@code src} data.
- * Can be null only if {@code length} is 0.
- * @param dstOff Index of the first element in {@code dst} where to insert {@code src} data.
- * All elements of {@code dst} whose index is equal to or greater than
- * {@code dstOff} will be moved forward.
- * @param length Number of {@code src} elements to insert.
- * @return Array which contains the merge of {@code src} and {@code dst}. This method
- * returns directly {@code dst} when {@code length} is zero, but never return
- * {@code src}.
- * @throws NullArgumentException
- * If {@code src} or {@code dst} is null while {@code length} is different than 0.
- * @throws IllegalArgumentException
- * If {@code length} is negative.
- * @throws IndexOutOfBoundsException
- * If {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds,
+ * Returns an array containing the same elements than the given array,
+ * with the content of an other array inserted at the given index.
+ * If the {@code length} argument is 0, then this method returns the {@code dst} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given arrays are never modified.
+ *
+ * @param src array to entirely or partially insert into {@code dst}. Can be null only if {@code length} is 0.
+ * @param srcOff index of the first element of {@code src} to insert into {@code dst}.
+ * @param dst array in which to insert {@code src} data. Can be null only if {@code length} is 0.
+ * @param dstOff index of the first element in {@code dst} where to insert {@code src} data.
+ * All elements of {@code dst} whose index is equal to or greater than {@code dstOff}
+ * will be moved forward.
+ * @param length number of {@code src} elements to insert.
+ * @return array which contains the merge of {@code src} and {@code dst}.
+ * This method returns directly {@code dst} when {@code length} is zero, but never return {@code src}.
+ * @throws NullArgumentException if {@code src} or {@code dst} is null while {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds.
*/
public static int[] insert(final int[] src, final int srcOff,
final int[] dst, final int dstOff, final int length)
@@ -1156,31 +1053,23 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with the content
- * of an other array inserted at the given index.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code dst}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given arrays are never modified.</p>
- *
- * @param src Array to entirely or partially insert into {@code dst}.
- * Can be null only if {@code length} is 0.
- * @param srcOff Index of the first element of {@code src} to insert into {@code dst}.
- * @param dst Array in which to insert {@code src} data.
- * Can be null only if {@code length} is 0.
- * @param dstOff Index of the first element in {@code dst} where to insert {@code src} data.
- * All elements of {@code dst} whose index is equal to or greater than
- * {@code dstOff} will be moved forward.
- * @param length Number of {@code src} elements to insert.
- * @return Array which contains the merge of {@code src} and {@code dst}. This method
- * returns directly {@code dst} when {@code length} is zero, but never return
- * {@code src}.
- * @throws NullArgumentException
- * If {@code src} or {@code dst} is null while {@code length} is different than 0.
- * @throws IllegalArgumentException
- * If {@code length} is negative.
- * @throws IndexOutOfBoundsException
- * If {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds,
+ * Returns an array containing the same elements than the given array,
+ * with the content of an other array inserted at the given index.
+ * If the {@code length} argument is 0, then this method returns the {@code dst} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given arrays are never modified.
+ *
+ * @param src array to entirely or partially insert into {@code dst}. Can be null only if {@code length} is 0.
+ * @param srcOff index of the first element of {@code src} to insert into {@code dst}.
+ * @param dst array in which to insert {@code src} data. Can be null only if {@code length} is 0.
+ * @param dstOff index of the first element in {@code dst} where to insert {@code src} data.
+ * All elements of {@code dst} whose index is equal to or greater than {@code dstOff}
+ * will be moved forward.
+ * @param length number of {@code src} elements to insert.
+ * @return array which contains the merge of {@code src} and {@code dst}.
+ * This method returns directly {@code dst} when {@code length} is zero, but never return {@code src}.
+ * @throws NullArgumentException if {@code src} or {@code dst} is null while {@code length} is different than 0.
+ * @throws IllegalArgumentException if {@code length} is negative.
+ * @throws IndexOutOfBoundsException if {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds.
*/
public static short[] insert(final short[] src, final int srcOff,
final short[] dst, final int dstOff, final int length)
@@ -1190,31 +1079,23 @@ public final class ArraysExt extends Sta
}
/**
- * Returns an array containing the same elements than the given array, with the content
- * of an other array inserted at the given index.
- *
- * <p>If the {@code length} argument is 0, then this method returns the {@code dst}
- * reference unchanged. Otherwise this method creates a new array. In every cases,
- * the given arrays are never modified.</p>
- *
- * @param src Array to entirely or partially insert into {@code dst}.
- * Can be null only if {@code length} is 0.
- * @param srcOff Index of the first element of {@code src} to insert into {@code dst}.
- * @param dst Array in which to insert {@code src} data.
- * Can be null only if {@code length} is 0.
- * @param dstOff Index of the first element in {@code dst} where to insert {@code src} data.
- * All elements of {@code dst} whose index is equal to or greater than
- * {@code dstOff} will be moved forward.
- * @param length Number of {@code src} elements to insert.
- * @return Array which contains the merge of {@code src} and {@code dst}. This method
- * returns directly {@code dst} when {@code length} is zero, but never return
- * {@code src}.
- * @throws NullArgumentException
- * If {@code src} or {@code dst} is null while {@code length} is different than 0.
- * @throws IllegalArgumentException
- * If {@code length} is negative.
- * @throws IndexOutOfBoundsException
- * If {@code srcOff}, {@code srcOff+length} or {@code dstOff} is out of array bounds,
+ * Returns an array containing the same elements than the given array,
+ * with the content of an other array inserted at the given index.
+ * If the {@code length} argument is 0, then this method returns the {@code dst} reference unchanged.
+ * Otherwise this method creates a new array. In every cases, the given arrays are never modified.
+ *
+ * @param src array to entirely or partially insert into {@code dst}. Can be null only if {@code length} is 0.
+ * @param srcOff index of the first element of {@code src} to insert into {@code dst}.
+ * @param dst array in which to insert {@code src} data. Can be null only if {@code length} is 0.
+ * @param dstOff index of the first element in {@code dst} where to insert {@code src} data.
+ * All elements of {@code dst} whose index is equal to or greater than {@code dstOff}
[... 548 lines stripped ...]