Class ReadAheadIterator<T>
java.lang.Object
com.sun.javatest.util.ReadAheadIterator<T>
- All Implemented Interfaces:
Iterator<T>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReadAheadIterator(Iterator<T> source, int mode) Create a ReadAheadIterator.ReadAheadIterator(Iterator<T> source, int mode, int amount) Create a ReadAheadIterator. -
Method Summary
Modifier and TypeMethodDescriptionintGet the number of items read (so far) from the underlying source iterator.intDeprecated.Will not be supported in the future.intDeprecated.Will not be supported in the future.booleanhasNext()booleanCheck if all available items from the underlying source iterator have been read.booleanDeprecated.Use hasNext().next()voidremove()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
NONE
public static final int NONEA constant indicating that no read ahead is required.- See Also:
-
LIMITED
public static final int LIMITEDA constant indicating that limited read ahead is required.- See Also:
-
FULL
public static final int FULLA constant indicating that full read ahead is required.- See Also:
-
-
Constructor Details
-
ReadAheadIterator
-
ReadAheadIterator
Create a ReadAheadIterator.- Parameters:
source- The iterator from which to read ahead.mode- A value indicating the type of read ahead required.amount- A value indicating the amount of read ahead required, if the mode is set to LIMITED. If the mode is NON or FULL, this parameter will be ignored.- See Also:
-
-
Method Details
-
isReadAheadComplete
public boolean isReadAheadComplete()Check if all available items from the underlying source iterator have been read.- Returns:
- true if all available items from the underlying source iterator have been read.
-
getItemsFoundCount
public int getItemsFoundCount()Get the number of items read (so far) from the underlying source iterator. If the read ahead has not yet completed, this will be a partial count of the total set of items available to be read. If the read ahead is complete, the value will be the total number of items returned from the underlying source iterator.- Returns:
- the number of items (so far) from the underlying source iterator.
- See Also:
-
isSourceExhausted
Deprecated.Use hasNext().Are there items that have not be read-ahead yet?- Returns:
- True if the source has no more elements, false otherwise.
-
getUsedElementCount
Deprecated.Will not be supported in the future.How many elements have been distributed throughgetNext().- Returns:
- number of used elements, greater-than or equal-to zero
- See Also:
-
getOutputQueueSize
Deprecated.Will not be supported in the future.Number of items have been read-ahead by not distributed.- Returns:
- number of items ready to be distributed, greater-than or equal-to zero
-
hasNext
-
next
-
remove
public void remove()- Specified by:
removein interfaceIterator<T>- Throws:
UnsupportedOperationException
-