T
- the item type.public final class RandomValueIterator<T> extends java.lang.Object implements BoundedIterator<T>
RandomValueIterator
implements a single-value iterator.Modifier | Constructor and Description |
---|---|
|
RandomValueIterator(java.util.Collection<T> array)
Constructs a random value iterator.
|
protected |
RandomValueIterator(RandomValueIterator<T> other)
Constructs a copy of the iterator.
|
|
RandomValueIterator(T[] array)
Constructs a random-value iterator.
|
Modifier and Type | Method and Description |
---|---|
RandomValueIterator<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.
|
public RandomValueIterator(T[] array)
array
- the array that stores possible values.public RandomValueIterator(java.util.Collection<T> array)
array
- the array list that stores possible values.protected RandomValueIterator(RandomValueIterator<T> other)
other
- the iterator to be copied.public void init()
Iterator
public boolean hasValue()
Iterator
public T value()
Iterator
public void next()
Iterator
public void stop()
Iterator
public int size()
BoundedIterator
size
in interface BoundedIterator<T>