Package org.geotools.util
Class LazySet<E>
- Object
-
- AbstractCollection<E>
-
- AbstractSet<E>
-
- LazySet<E>
-
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>
public final class LazySet<E> extends AbstractSet<E>
An immutable set built from an iterator, which will be filled only when needed. This implementation do not check if all elements in the iterator are really unique; we assume that it was already verified byServiceRegistry. This set is constructed byorg.geotools.referencing.FactoryFinder.- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Eget(int index)Returns the element at the specified position in this set.booleanisEmpty()Tests if this set has no elements.Iterator<E>iterator()Returns an iterator over the elements contained in this set.intsize()Returns the number of elements in this set.-
Methods inherited from class AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class AbstractCollection
add, addAll, clear, contains, containsAll, remove, retainAll, toArray, toArray, toString
-
Methods inherited from interface Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Method Detail
-
iterator
public Iterator<E> iterator()
Returns an iterator over the elements contained in this set. This is not the same iterator than the one given to the constructor.
-
size
public int size()
Returns the number of elements in this set. Invoking this method force the set to immediately iterates through all remaining elements.- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()
Tests if this set has no elements.- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceSet<E>- Overrides:
isEmptyin classAbstractCollection<E>
-
get
public E get(int index)
Returns the element at the specified position in this set.
-
-