Class LazySet<ElementType>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.collection.LazySet<ElementType>
-
- Type Parameters:
ElementType- type of the elements within the set
- All Implemented Interfaces:
Serializable,Iterable<ElementType>,Collection<ElementType>,Set<ElementType>
@NotThreadSafe public class LazySet<ElementType> extends Object implements Set<ElementType>, Serializable
A set that is lazy initialized. This set takes very little memory when storing zero or one item.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Set<ElementType>delegateThe delegate set.private static longserialVersionUIDSerial version UID.
-
Constructor Summary
Constructors Constructor Description LazySet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(ElementType element)booleanaddAll(Collection<? extends ElementType> collection)voidclear()booleancontains(Object element)booleancontainsAll(Collection<?> collection)private Set<ElementType>createImplementation()Builds an appropriate delegate set.booleanequals(Object obj)inthashCode()booleanisEmpty()Iterator<ElementType>iterator()booleanremove(Object element)booleanremoveAll(Collection<?> collection)booleanretainAll(Collection<?> collection)intsize()Object[]toArray()<T> T[]toArray(T[] type)StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
spliterator
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial version UID.- See Also:
- Constant Field Values
-
delegate
private Set<ElementType> delegate
The delegate set.
-
-
Method Detail
-
add
public boolean add(ElementType element)
- Specified by:
addin interfaceCollection<ElementType>- Specified by:
addin interfaceSet<ElementType>
-
addAll
public boolean addAll(Collection<? extends ElementType> collection)
- Specified by:
addAllin interfaceCollection<ElementType>- Specified by:
addAllin interfaceSet<ElementType>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<ElementType>- Specified by:
clearin interfaceSet<ElementType>
-
contains
public boolean contains(Object element)
- Specified by:
containsin interfaceCollection<ElementType>- Specified by:
containsin interfaceSet<ElementType>
-
containsAll
public boolean containsAll(Collection<?> collection)
- Specified by:
containsAllin interfaceCollection<ElementType>- Specified by:
containsAllin interfaceSet<ElementType>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<ElementType>- Specified by:
isEmptyin interfaceSet<ElementType>
-
iterator
public Iterator<ElementType> iterator()
- Specified by:
iteratorin interfaceCollection<ElementType>- Specified by:
iteratorin interfaceIterable<ElementType>- Specified by:
iteratorin interfaceSet<ElementType>
-
remove
public boolean remove(Object element)
- Specified by:
removein interfaceCollection<ElementType>- Specified by:
removein interfaceSet<ElementType>
-
removeAll
public boolean removeAll(Collection<?> collection)
- Specified by:
removeAllin interfaceCollection<ElementType>- Specified by:
removeAllin interfaceSet<ElementType>
-
retainAll
public boolean retainAll(Collection<?> collection)
- Specified by:
retainAllin interfaceCollection<ElementType>- Specified by:
retainAllin interfaceSet<ElementType>
-
size
public int size()
- Specified by:
sizein interfaceCollection<ElementType>- Specified by:
sizein interfaceSet<ElementType>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<ElementType>- Specified by:
toArrayin interfaceSet<ElementType>
-
toArray
public <T> T[] toArray(T[] type)
- Specified by:
toArrayin interfaceCollection<ElementType>- Specified by:
toArrayin interfaceSet<ElementType>
-
createImplementation
private Set<ElementType> createImplementation()
Builds an appropriate delegate set.- Returns:
- the delegate set
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<ElementType>- Specified by:
hashCodein interfaceSet<ElementType>- Overrides:
hashCodein classObject
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceCollection<ElementType>- Specified by:
equalsin interfaceSet<ElementType>- Overrides:
equalsin classObject
-
-