Added size().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@826 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ListUtil.java,v 1.7 2002/04/13 01:39:17 mdb Exp $
|
||||
// $Id: ListUtil.java,v 1.8 2002/09/06 02:09:05 shaper Exp $
|
||||
|
||||
package com.samskivert.util;
|
||||
|
||||
@@ -420,6 +420,20 @@ public class ListUtil
|
||||
return elem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the supplied list.
|
||||
*/
|
||||
public static int size (Object[] list)
|
||||
{
|
||||
int llength = list.length;
|
||||
for (int ii = 0; ii < llength; ii++) {
|
||||
if (list[ii] == null) {
|
||||
return ii;
|
||||
}
|
||||
}
|
||||
return llength;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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