1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Adjusted javadoc comments.

This commit is contained in:
Sergey Prigogin 2009-10-06 05:45:55 +00:00
parent 8db497abb6
commit dbec91987b

View file

@ -85,7 +85,7 @@ public abstract class ArrayUtil {
if (currentLength < array.length) { if (currentLength < array.length) {
assert array[currentLength] == null; assert array[currentLength] == null;
assert currentLength == 0 || array[currentLength-1] != null; assert currentLength == 0 || array[currentLength - 1] != null;
array[currentLength]= obj; array[currentLength]= obj;
return array; return array;
} }
@ -99,7 +99,8 @@ public abstract class ArrayUtil {
/** /**
* Assumes that array contains nulls at the end, only. * Assumes that array contains nulls at the end, only.
* Appends element after the last non-null element. * Appends element after the last non-null element.
* If the array is null or not large enough, a larger one is allocated. * If the array is not large enough, a larger one is allocated.
* Null <code>array</code> is supported for backward compatibility only and only when T is Object.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
static public <T> T[] append(T[] array, T obj) { static public <T> T[] append(T[] array, T obj) {
@ -418,7 +419,7 @@ public abstract class ArrayUtil {
* The position of the last non-null element in the array must also be known. * The position of the last non-null element in the array must also be known.
*/ */
public static Object[] removeNullsAfter(Class<?> c, Object[] array, int index) { public static Object[] removeNullsAfter(Class<?> c, Object[] array, int index) {
final int newLen= index+1; final int newLen= index + 1;
if (array != null && array.length == newLen) if (array != null && array.length == newLen)
return array; return array;
@ -458,7 +459,7 @@ public abstract class ArrayUtil {
Object[] temp = (Object[]) Array.newInstance(c, array.length * 2); Object[] temp = (Object[]) Array.newInstance(c, array.length * 2);
System.arraycopy(array, 0, temp, 1, array.length); System.arraycopy(array, 0, temp, 1, array.length);
temp[0] = obj; temp[0] = obj;
array = temp; array = temp;
} }
return array; return array;
@ -472,8 +473,8 @@ public abstract class ArrayUtil {
if (array != null) { if (array != null) {
for (int i = 0; i < array.length; i++) { for (int i = 0; i < array.length; i++) {
if (element == array[i]) { if (element == array[i]) {
System.arraycopy(array, i+1, array, i, array.length-i-1); System.arraycopy(array, i + 1, array, i, array.length - i - 1);
array[array.length-1]= null; array[array.length - 1]= null;
return; return;
} }
} }