Package io.ryos.rhino.sdk
Class CyclicIterator<T>
- java.lang.Object
-
- io.ryos.rhino.sdk.CyclicIterator<T>
-
- All Implemented Interfaces:
java.util.Iterator<T>
@ThreadSafe public class CyclicIterator<T> extends java.lang.Object implements java.util.Iterator<T>
Cyclic iterator iterates over the list provided, and once the list is over it starts from the beginning till the iteration is stopped by callingstop()
to do so, explicitly. The iterator is used as generator for the load generator system.- Version:
- 1.0.0
- Author:
- Erhan Bagdemir
-
-
Constructor Summary
Constructors Constructor Description CyclicIterator(java.util.List<T> list)
Creates a newCyclicIterator
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
The method returns a boolean value indicating whether the iterator has more items.T
next()
Returns the next item where the cursor points to.void
stop()
Sets the hasNext attribute to false.
-
-
-
Constructor Detail
-
CyclicIterator
public CyclicIterator(java.util.List<T> list)
Creates a newCyclicIterator
instance.- Parameters:
list
- The list backing the iterator.
-
-
Method Detail
-
hasNext
public boolean hasNext()
The method returns a boolean value indicating whether the iterator has more items.- Specified by:
hasNext
in interfacejava.util.Iterator<T>
- Returns:
- boolean, whether the iterator has more items.
-
next
public T next()
Returns the next item where the cursor points to. Calling this method sets the cursor forward to point the next item in the list. If the cursor is at the end of the list, it begins from the first item.- Specified by:
next
in interfacejava.util.Iterator<T>
- Returns:
- The current item, pointed by the cursor.
-
stop
public void stop()
Sets the hasNext attribute to false. Every next method call after stop causes aNoSuchElementException
.
-
-