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>
delegate
The delegate set.private static long
serialVersionUID
Serial version UID. -
Constructor Summary
Constructors Constructor Description LazySet()
-
Method Summary
Modifier and Type Method Description boolean
add(ElementType element)
boolean
addAll(Collection<? extends ElementType> collection)
void
clear()
boolean
contains(Object element)
boolean
containsAll(Collection<?> collection)
private Set<ElementType>
createImplementation()
Builds an appropriate delegate set.boolean
equals(Object obj)
int
hashCode()
boolean
isEmpty()
Iterator<ElementType>
iterator()
boolean
remove(Object element)
boolean
removeAll(Collection<?> collection)
boolean
retainAll(Collection<?> collection)
int
size()
Object[]
toArray()
<T> T[]
toArray(T[] type)
String
toString()
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 Details
-
serialVersionUID
private static final long serialVersionUIDSerial version UID.- See Also:
- Constant Field Values
-
delegate
The delegate set.
-
-
Constructor Details
-
LazySet
public LazySet()
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<ElementType>
- Specified by:
add
in interfaceSet<ElementType>
-
addAll
- Specified by:
addAll
in interfaceCollection<ElementType>
- Specified by:
addAll
in interfaceSet<ElementType>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<ElementType>
- Specified by:
clear
in interfaceSet<ElementType>
-
contains
- Specified by:
contains
in interfaceCollection<ElementType>
- Specified by:
contains
in interfaceSet<ElementType>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<ElementType>
- Specified by:
containsAll
in interfaceSet<ElementType>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<ElementType>
- Specified by:
isEmpty
in interfaceSet<ElementType>
-
iterator
- Specified by:
iterator
in interfaceCollection<ElementType>
- Specified by:
iterator
in interfaceIterable<ElementType>
- Specified by:
iterator
in interfaceSet<ElementType>
-
remove
- Specified by:
remove
in interfaceCollection<ElementType>
- Specified by:
remove
in interfaceSet<ElementType>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<ElementType>
- Specified by:
removeAll
in interfaceSet<ElementType>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<ElementType>
- Specified by:
retainAll
in interfaceSet<ElementType>
-
size
public int size()- Specified by:
size
in interfaceCollection<ElementType>
- Specified by:
size
in interfaceSet<ElementType>
-
toArray
- Specified by:
toArray
in interfaceCollection<ElementType>
- Specified by:
toArray
in interfaceSet<ElementType>
-
toArray
public <T> T[] toArray(T[] type)- Specified by:
toArray
in interfaceCollection<ElementType>
- Specified by:
toArray
in interfaceSet<ElementType>
-
createImplementation
Builds an appropriate delegate set.- Returns:
- the delegate set
-
toString
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<ElementType>
- Specified by:
hashCode
in interfaceSet<ElementType>
- Overrides:
hashCode
in classObject
-
equals
- Specified by:
equals
in interfaceCollection<ElementType>
- Specified by:
equals
in interfaceSet<ElementType>
- Overrides:
equals
in classObject
-