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:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`private Set<ElementType>`
`delegate`
The delegate set.
`private static final 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.lang.Iterable

`forEach`

### Methods inherited from interface java.util.Set

`spliterator`

## Field Details

### serialVersionUID

private static final long serialVersionUID
Serial version UID.

See Also:
  - Constant Field Values

### delegate

@Nonnull private Set<ElementType> delegate
The delegate set.

## Constructor Details

### LazySet

public LazySet()

## Method Details

### add

public boolean add(ElementType element)

Specified by:
  `add` in interface `Collection<ElementType>`
Specified by:
  `add` in interface `Set<ElementType>`

### addAll

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

Specified by:
  `addAll` in interface `Collection<ElementType>`
Specified by:
  `addAll` in interface `Set<ElementType>`

### clear

public void clear()

Specified by:
  `clear` in interface `Collection<ElementType>`
Specified by:
  `clear` in interface `Set<ElementType>`

### contains

public boolean contains(Object element)

Specified by:
  `contains` in interface `Collection<ElementType>`
Specified by:
  `contains` in interface `Set<ElementType>`

### containsAll

public boolean containsAll(Collection<?> collection)

Specified by:
  `containsAll` in interface `Collection<ElementType>`
Specified by:
  `containsAll` in interface `Set<ElementType>`

### isEmpty

public boolean isEmpty()

Specified by:
  `isEmpty` in interface `Collection<ElementType>`
Specified by:
  `isEmpty` in interface `Set<ElementType>`

### iterator

public Iterator<ElementType> iterator()

Specified by:
  `iterator` in interface `Collection<ElementType>`
Specified by:
  `iterator` in interface `Iterable<ElementType>`
Specified by:
  `iterator` in interface `Set<ElementType>`

### remove

public boolean remove(Object element)

Specified by:
  `remove` in interface `Collection<ElementType>`
Specified by:
  `remove` in interface `Set<ElementType>`

### removeAll

public boolean removeAll(Collection<?> collection)

Specified by:
  `removeAll` in interface `Collection<ElementType>`
Specified by:
  `removeAll` in interface `Set<ElementType>`

### retainAll

public boolean retainAll(Collection<?> collection)

Specified by:
  `retainAll` in interface `Collection<ElementType>`
Specified by:
  `retainAll` in interface `Set<ElementType>`

### size

public int size()

Specified by:
  `size` in interface `Collection<ElementType>`
Specified by:
  `size` in interface `Set<ElementType>`

### toArray

public Object[] toArray()

Specified by:
  `toArray` in interface `Collection<ElementType>`
Specified by:
  `toArray` in interface `Set<ElementType>`

### toArray

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

Specified by:
  `toArray` in interface `Collection<ElementType>`
Specified by:
  `toArray` in interface `Set<ElementType>`

### createImplementation

@Nonnull private Set<ElementType> createImplementation()
Builds an appropriate delegate set.

Returns:
  the delegate set

### 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 `Set<ElementType>`
Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)

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