Deprecate size(), add getSize().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2792 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -439,9 +439,10 @@ public class ListUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the supplied list.
|
||||
* Returns the number of elements prior to the first null in the supplied list.
|
||||
* @deprecated This is incompatible with things like clearRef(), which leave a null space.
|
||||
*/
|
||||
public static int size (Object[] list)
|
||||
@Deprecated public static int size (Object[] list)
|
||||
{
|
||||
if (list == null) {
|
||||
return 0;
|
||||
@@ -455,6 +456,20 @@ public class ListUtil
|
||||
return llength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of non-null elements in the supplied list.
|
||||
*/
|
||||
public static int getSize (Object[] list)
|
||||
{
|
||||
int size = 0;
|
||||
for (int ii = 0, nn = (list == null) ? 0 : list.length; ii < nn; ii++) {
|
||||
if (list[ii] != null) {
|
||||
size++;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new list that will accomodate the specified index and
|
||||
* copies the contents of the old list to the first.
|
||||
|
||||
Reference in New Issue
Block a user