public class LazyList extends Object implements Cloneable, Serializable
Object lazylist =null;
while(loopCondition)
{
Object item = getItem();
if (item.isToBeAdded())
lazylist = LazyList.add(lazylist,item);
}
return LazyList.getList(lazylist);
An ArrayList of default size is used as the initial LazyList.List,
Serialized Form| Modifier and Type | Method and Description |
|---|---|
static Object |
add(Object list,
int index,
Object item)
Add an item to a LazyList
|
static Object |
add(Object list,
Object item)
Add an item to a LazyList
|
static Object |
addArray(Object list,
Object[] array)
Add the contents of an array to a LazyList
|
static Object |
addCollection(Object list,
Collection collection)
Add the contents of a Collection to a LazyList
|
static Object[] |
addToArray(Object[] array,
Object item,
Class type)
Add element to an array
|
static List |
array2List(Object[] array) |
static Object |
clone(Object list) |
static boolean |
contains(Object list,
Object item) |
static Object |
ensureSize(Object list,
int initialSize)
Ensure the capcity of the underlying list.
|
static Object |
get(Object list,
int i)
Get item from the list
|
static List |
getList(Object list)
Get the real List from a LazyList.
|
static List |
getList(Object list,
boolean nullForEmpty)
Get the real List from a LazyList.
|
static Iterator |
iterator(Object list) |
static ListIterator |
listIterator(Object list) |
static Object |
remove(Object list,
int i) |
static Object |
remove(Object list,
Object o) |
static Object[] |
removeFromArray(Object[] array,
Object item) |
static int |
size(Object list)
The size of a lazy List
|
static Object |
toArray(Object list,
Class aClass) |
static String |
toString(Object list) |
static String[] |
toStringArray(Object list) |
public static Object add(Object list, Object item)
list - The list to add to or null if none yet created.item - The item to add.public static Object add(Object list, int index, Object item)
list - The list to add to or null if none yet created.index - The index to add the item at.item - The item to add.public static Object addCollection(Object list, Collection collection)
list - The list to add to or null if none yet created.collection - The Collection whose contents should be added.public static Object addArray(Object list, Object[] array)
list - The list to add to or null if none yet created.collection - The Collection whose contents should be added.public static Object ensureSize(Object list, int initialSize)
public static List getList(Object list)
list - A LazyList returned from LazyList.add(Object)public static List getList(Object list, boolean nullForEmpty)
list - A LazyList returned from LazyList.add(Object) or nullnullForEmpty - If true, null is returned instead of an
empty list.public static int size(Object list)
list - A LazyList returned from LazyList.add(Object) or nullpublic static Object get(Object list, int i)
list - A LazyList returned from LazyList.add(Object) or nulli - int indexpublic static ListIterator listIterator(Object list)
public static List array2List(Object[] array)
array - Any array of objectarray.public static Object[] addToArray(Object[] array, Object item, Class type)
array - The array to add to (or null)item - The item to addtype - The type of the array (in case of null array)Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.