Package net.shibboleth.shared.collection
Class LazySet<ElementType>
java.lang.Object
net.shibboleth.shared.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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Set<ElementType>The delegate set.private static final longSerial version UID. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(ElementType element) booleanaddAll(Collection<? extends ElementType> collection) voidclear()booleanbooleancontainsAll(Collection<?> collection) private Set<ElementType>Builds an appropriate delegate set.booleaninthashCode()booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> collection) booleanretainAll(Collection<?> collection) intsize()Object[]toArray()<T> T[]toArray(T[] type) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial version UID.- See Also:
-
delegate
The delegate set.
-
-
Constructor Details
-
LazySet
public LazySet()
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<ElementType>- Specified by:
addin interfaceSet<ElementType>
-
addAll
- 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
- Specified by:
containsin interfaceCollection<ElementType>- Specified by:
containsin interfaceSet<ElementType>
-
containsAll
- 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
- Specified by:
iteratorin interfaceCollection<ElementType>- Specified by:
iteratorin interfaceIterable<ElementType>- Specified by:
iteratorin interfaceSet<ElementType>
-
remove
- Specified by:
removein interfaceCollection<ElementType>- Specified by:
removein interfaceSet<ElementType>
-
removeAll
- Specified by:
removeAllin interfaceCollection<ElementType>- Specified by:
removeAllin interfaceSet<ElementType>
-
retainAll
- 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
- 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
Builds an appropriate delegate set.- Returns:
- the delegate set
-
toString
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<ElementType>- Specified by:
hashCodein interfaceSet<ElementType>- Overrides:
hashCodein classObject
-
equals
- Specified by:
equalsin interfaceCollection<ElementType>- Specified by:
equalsin interfaceSet<ElementType>- Overrides:
equalsin classObject
-