public class SimpleEnumerator<E> extends Base implements Enumeration<E>, Iterator<E>
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
protected E[] |
m_aoItem
Array of items to enumerate.
|
protected boolean |
m_fForward
Iterator direction.
|
protected int |
m_iItem
Iterator position: next item to return.
|
protected int |
m_ofLimit
Iterator end position (beyond last).
|
Constructor and Description |
---|
SimpleEnumerator(Collection<E> col)
Construct a simple enumerator based on a collection.
|
SimpleEnumerator(E[] aoItem)
Construct the simple enumerator based on an array of objects.
|
SimpleEnumerator(E[] aoItem,
int ofStart,
int cItems)
Construct the simple enumerator based on an array of objects.
|
SimpleEnumerator(E[] aoItem,
int ofStart,
int cItems,
boolean fForward,
boolean fCopy)
Construct the simple enumerator based on an array of objects, making
a copy of the array if specified.
|
SimpleEnumerator(Enumeration<E> enmr)
Construct a simple enumerator based on another Enumeration.
|
SimpleEnumerator(Iterator<E> iter)
Construct a simple enumerator based on another Iterator.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasMoreElements()
Tests if this enumeration contains more elements.
|
boolean |
hasNext()
Tests if this Iterator contains more elements.
|
E |
next()
Returns the next element of this Iterator.
|
E |
nextElement()
Returns the next element of this enumeration.
|
void |
remove()
Remove the last-returned element that was returned by the Iterator.
|
Object[] |
toArray()
Return the remaining contents of this SimpleEnumerator as an array.
|
static <T> T[] |
toArray(Enumeration<T> enmr)
Turns an enumeration into an array.
|
static <T> T[] |
toArray(Enumeration<T> enmr,
T[] ao)
Turns an enumeration into an array.
|
static <T> T[] |
toArray(Iterator<T> iter)
Turns an Iterator into an array.
|
static <T> T[] |
toArray(Iterator<T> iter,
T[] ao)
Turns an Iterator into an array.
|
<T> T[] |
toArray(T[] ao)
Return the remaining contents of this SimpleEnumerator as an array of
the type specified by the passed array, and use that passed array to
store the values if it is big enough, putting a null in the first
unused element if the size of the passed array is bigger than the
number of remaining elements in this enumerator, as per the contract
of the
Collection.toArray(Object[]) method. |
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
protected E[] m_aoItem
protected int m_iItem
protected int m_ofLimit
protected boolean m_fForward
public SimpleEnumerator(E[] aoItem)
aoItem
- array of objects to enumeratepublic SimpleEnumerator(E[] aoItem, int ofStart, int cItems)
aoItem
- array of objects to enumerateofStart
- the first object positioncItems
- the number of objects to enumeratepublic SimpleEnumerator(E[] aoItem, int ofStart, int cItems, boolean fForward, boolean fCopy)
aoItem
- array of objects to enumerateofStart
- the first object positioncItems
- the number of objects to enumeratefForward
- true to iterate forwards, false to iterate from the
end backwards to the beginningfCopy
- pass true to make a copy of the array or false if the
array's contents will not changepublic SimpleEnumerator(Enumeration<E> enmr)
enmr
- the java.util.Enumeration to enumeratepublic SimpleEnumerator(Iterator<E> iter)
iter
- the java.util.Iterator to enumeratepublic SimpleEnumerator(Collection<E> col)
col
- the java.util.Collection to enumeratepublic boolean hasMoreElements()
hasMoreElements
in interface Enumeration<E>
public E nextElement()
nextElement
in interface Enumeration<E>
public boolean hasNext()
public E next()
public void remove()
public static <T> T[] toArray(Enumeration<T> enmr)
enmr
- the enumeratorpublic static <T> T[] toArray(Enumeration<T> enmr, T[] ao)
toArray(Enumeration)
method in the same way
that the Collection.toArray(Object[])
method differs from the
Collection.toArray()
method.enmr
- the enumeratorao
- the array into which the elements of the Enumeration are
to be stored, if it is big enough; otherwise, a new array
of the same runtime type is allocated for this purposepublic static <T> T[] toArray(Iterator<T> iter)
iter
- the Iteratorpublic static <T> T[] toArray(Iterator<T> iter, T[] ao)
toArray(Iterator)
method in the same way that
the Collection.toArray(Object[])
method differs from the
Collection.toArray()
method.iter
- the Iteratorao
- the array into which the elements of the Iterator are
to be stored, if it is big enough; otherwise, a new array
of the same runtime type is allocated for this purposepublic Object[] toArray()
public <T> T[] toArray(T[] ao)
Collection.toArray(Object[])
method.ao
- the array into which the elements of the Enumeration are
to be stored, if it is big enough; otherwise, a new array
of the same runtime type is allocated for this purposeArrayStoreException
- if the runtime type of the specified array
is not a supertype of the runtime type of every element in this
collection