org.geotools.resources
Class LazySet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byorg.geotools.resources.LazySet
All Implemented Interfaces:
java.util.Collection, java.util.Set

public final class LazySet
extends java.util.AbstractSet

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 FactoryFinder.

Since:
2.0
Version:
$Id: LazySet.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Constructor Summary
LazySet(java.util.Iterator iterator)
          Construct a set to be filled using the specified iterator.
 
Method Summary
 java.lang.Object get(int index)
          Returns the element at the specified position in this set.
 boolean isEmpty()
          Tests if this set has no elements.
 java.util.Iterator iterator()
          Returns an iterator over the elements contained in this set.
 int size()
          Returns the number of elements in this set.
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, remove, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, remove, retainAll, toArray, toArray
 

Constructor Detail

LazySet

public LazySet(java.util.Iterator iterator)
Construct a set to be filled using the specified iterator. Iteration in the given iterator will occurs only when needed.

Method Detail

iterator

public java.util.Iterator 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.


isEmpty

public boolean isEmpty()
Tests if this set has no elements.


get

public java.lang.Object get(int index)
Returns the element at the specified position in this set.



Copyright © GeoTools. All Rights Reserved.