diff --git a/projects/samskivert/src/java/com/samskivert/util/ListUtil.java b/projects/samskivert/src/java/com/samskivert/util/ListUtil.java index bca08728..3b2a327f 100644 --- a/projects/samskivert/src/java/com/samskivert/util/ListUtil.java +++ b/projects/samskivert/src/java/com/samskivert/util/ListUtil.java @@ -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.