org.opensaml.xml.util
Class LazyList<ElementType>

java.lang.Object
  extended by org.opensaml.xml.util.LazyList<ElementType>
Type Parameters:
ElementType - type of elements within the list
All Implemented Interfaces:
Serializable, Iterable<ElementType>, Collection<ElementType>, List<ElementType>

@NotThreadSafe
public class LazyList<ElementType>
extends Object
implements List<ElementType>, Serializable

A list that is lazy initialized. This list takes very little memory when storing zero or one item.

See Also:
Serialized Form

Constructor Summary
LazyList()
           
 
Method Summary
 boolean add(ElementType item)
          
 void add(int index, ElementType element)
          
 boolean addAll(Collection<? extends ElementType> collection)
          
 boolean addAll(int index, Collection<? extends ElementType> collection)
          
protected  List<ElementType> buildList()
          Builds an appropriate delegate for this list.
 void clear()
          
 boolean contains(Object element)
          
 boolean containsAll(Collection<?> collections)
          
 boolean equals(Object obj)
          
 ElementType get(int index)
          
 int hashCode()
          
 int indexOf(Object element)
          
 boolean isEmpty()
          
 Iterator<ElementType> iterator()
          
 int lastIndexOf(Object element)
          
 ListIterator<ElementType> listIterator()
          
 ListIterator<ElementType> listIterator(int index)
          
 ElementType remove(int index)
          
 boolean remove(Object element)
          
 boolean removeAll(Collection<?> collection)
          
 boolean retainAll(Collection<?> collection)
          
 ElementType set(int index, ElementType element)
          
 int size()
          
 List<ElementType> subList(int fromIndex, int toIndex)
          
 Object[] toArray()
          
<T> T[]
toArray(T[] type)
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LazyList

public LazyList()
Method Detail

add

public boolean add(ElementType item)

Specified by:
add in interface Collection<ElementType>
Specified by:
add in interface List<ElementType>

add

public void add(int index,
                ElementType element)

Specified by:
add in interface List<ElementType>

addAll

public boolean addAll(Collection<? extends ElementType> collection)

Specified by:
addAll in interface Collection<ElementType>
Specified by:
addAll in interface List<ElementType>

addAll

public boolean addAll(int index,
                      Collection<? extends ElementType> collection)

Specified by:
addAll in interface List<ElementType>

clear

public void clear()

Specified by:
clear in interface Collection<ElementType>
Specified by:
clear in interface List<ElementType>

contains

public boolean contains(Object element)

Specified by:
contains in interface Collection<ElementType>
Specified by:
contains in interface List<ElementType>

containsAll

public boolean containsAll(Collection<?> collections)

Specified by:
containsAll in interface Collection<ElementType>
Specified by:
containsAll in interface List<ElementType>

get

public ElementType get(int index)

Specified by:
get in interface List<ElementType>

indexOf

public int indexOf(Object element)

Specified by:
indexOf in interface List<ElementType>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Collection<ElementType>
Specified by:
isEmpty in interface List<ElementType>

iterator

public Iterator<ElementType> iterator()

Specified by:
iterator in interface Iterable<ElementType>
Specified by:
iterator in interface Collection<ElementType>
Specified by:
iterator in interface List<ElementType>

lastIndexOf

public int lastIndexOf(Object element)

Specified by:
lastIndexOf in interface List<ElementType>

listIterator

public ListIterator<ElementType> listIterator()

Specified by:
listIterator in interface List<ElementType>

listIterator

public ListIterator<ElementType> listIterator(int index)

Specified by:
listIterator in interface List<ElementType>

remove

public boolean remove(Object element)

Specified by:
remove in interface Collection<ElementType>
Specified by:
remove in interface List<ElementType>

remove

public ElementType remove(int index)

Specified by:
remove in interface List<ElementType>

removeAll

public boolean removeAll(Collection<?> collection)

Specified by:
removeAll in interface Collection<ElementType>
Specified by:
removeAll in interface List<ElementType>

retainAll

public boolean retainAll(Collection<?> collection)

Specified by:
retainAll in interface Collection<ElementType>
Specified by:
retainAll in interface List<ElementType>

set

public ElementType set(int index,
                       ElementType element)

Specified by:
set in interface List<ElementType>

size

public int size()

Specified by:
size in interface Collection<ElementType>
Specified by:
size in interface List<ElementType>

subList

public List<ElementType> subList(int fromIndex,
                                 int toIndex)

Specified by:
subList in interface List<ElementType>

toArray

public Object[] toArray()

Specified by:
toArray in interface Collection<ElementType>
Specified by:
toArray in interface List<ElementType>

toArray

public <T> T[] toArray(T[] type)

Specified by:
toArray in interface Collection<ElementType>
Specified by:
toArray in interface List<ElementType>

buildList

protected List<ElementType> buildList()
Builds an appropriate delegate for this list.

Returns:
delegate for this list

toString

public String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()

Specified by:
hashCode in interface Collection<ElementType>
Specified by:
hashCode in interface List<ElementType>
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Specified by:
equals in interface Collection<ElementType>
Specified by:
equals in interface List<ElementType>
Overrides:
equals in class Object


Copyright © 2006-2011 Internet2. All Rights Reserved.