Package org.geotools.util
Class LazySet<E>
Object
AbstractCollection<E>
AbstractSet<E>
LazySet<E>
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<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
by
ServiceRegistry
. This set is constructed by
org.geotools.referencing.FactoryFinder
.- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
-
Constructor Summary
Constructors -
Method Summary
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
-
Constructor Details
-
LazySet
Construct a set to be filled using the specified iterator. Iteration in the given iterator will occurs only when needed. -
LazySet
Construct a set to be filled using the specified iterator. Iteration in the given iterator will occurs only when needed.
-
-
Method Details
-
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:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()Tests if this set has no elements.- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceSet<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
get
Returns the element at the specified position in this set.
-