Class CollectionIterator<T>
- java.lang.Object
-
- ru.ispras.testbase.knowledge.iterator.CollectionIterator<T>
-
- Type Parameters:
T
- the item type.
- All Implemented Interfaces:
BoundedIterator<T>
,Iterator<T>
public final class CollectionIterator<T> extends java.lang.Object implements BoundedIterator<T>
CollectionIterator
implements a collection iterator.
-
-
Constructor Summary
Constructors Constructor Description CollectionIterator(java.util.Collection<T> collection)
Constructs a collection iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CollectionIterator<T>
clone()
Creates a copy of the iterator.boolean
hasValue()
Checks if the iterator is not exhausted (a value is available).void
init()
Initializes the iterator.void
next()
Makes an iteration.int
size()
Returns the size of the collection of the iterated items.void
stop()
Stops the iterator.T
value()
Returns the current value of the iterator.
-
-
-
Constructor Detail
-
CollectionIterator
public CollectionIterator(java.util.Collection<T> collection)
Constructs a collection iterator.- Parameters:
collection
- the collection to be iterated.
-
-
Method Detail
-
init
public void init()
Description copied from interface:Iterator
Initializes the iterator.
-
hasValue
public boolean hasValue()
Description copied from interface:Iterator
Checks if the iterator is not exhausted (a value is available).
-
value
public T value()
Description copied from interface:Iterator
Returns the current value of the iterator.
-
next
public void next()
Description copied from interface:Iterator
Makes an iteration.
-
stop
public void stop()
Description copied from interface:Iterator
Stops the iterator.
-
size
public int size()
Description copied from interface:BoundedIterator
Returns the size of the collection of the iterated items.- Specified by:
size
in interfaceBoundedIterator<T>
- Returns:
- the number of items being iterated.
-
-