Package com.tangosol.util
Class RestrictedCollections.RestrictedListIterator
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.RestrictedCollections.RestrictedListIterator
- All Implemented Interfaces:
Iterator
,ListIterator
- Enclosing class:
RestrictedCollections
public static class RestrictedCollections.RestrictedListIterator
extends Base
implements ListIterator
A restricted ListIterator that requires its contents to be of a
specified class.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Modifier and TypeFieldDescriptionprotected Class
The class of Objects stored in the ListIterator.protected ListIterator
The underlying ListIterator. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts the specified element into the list.protected void
Check the passed object to verify that it passes the restriction of this ListIterator.boolean
hasNext()
Returns true if this list iterator has more elements when traversing the list in the forward direction.boolean
Returns true if this list iterator has more elements when traversing the list in the reverse direction.next()
Returns the next element in the list.int
Returns the index of the element that would be returned by a subsequent call to next.previous()
Returns the previous element in the list.int
Returns the index of the element that would be returned by a subsequent call to previous.void
remove()
Removes from the list the last element that was returned by next or previous.void
Replaces the last element returned by next or previous with the specified element.Methods inherited from class com.tangosol.util.Base
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, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
m_iter
The underlying ListIterator. -
m_clz
The class of Objects stored in the ListIterator.
-
-
Constructor Details
-
RestrictedListIterator
Constructor.- Parameters:
iter
- the underlying ListIteratorclz
- the class of objects that may be stored in the ListIterator
-
-
Method Details
-
hasNext
public boolean hasNext()Returns true if this list iterator has more elements when traversing the list in the forward direction. Obeys the general contract of ListIterator.hasNext.- Specified by:
hasNext
in interfaceIterator
- Specified by:
hasNext
in interfaceListIterator
- Returns:
- true if the list iterator has more elements when traversing the list in the forward direction
-
next
Returns the next element in the list. Obeys the general contract of ListIterator.next.- Specified by:
next
in interfaceIterator
- Specified by:
next
in interfaceListIterator
- Returns:
- the next element in the list
-
hasPrevious
public boolean hasPrevious()Returns true if this list iterator has more elements when traversing the list in the reverse direction. Obeys the general contract of ListIterator.hasPrevious.- Specified by:
hasPrevious
in interfaceListIterator
- Returns:
- true if the list iterator has more elements when traversing the list in the reverse direction
-
previous
Returns the previous element in the list. Obeys the general contract of ListIterator.previous.- Specified by:
previous
in interfaceListIterator
- Returns:
- the previous element in the list
- Throws:
NoSuchElementException
- if the iteration has no previous element
-
nextIndex
public int nextIndex()Returns the index of the element that would be returned by a subsequent call to next. Obeys the general contract of ListIterator.nextIndex.- Specified by:
nextIndex
in interfaceListIterator
- Returns:
- the index of the element that would be returned by a subsequent call to next, or list size if list iterator is at end of list
-
previousIndex
public int previousIndex()Returns the index of the element that would be returned by a subsequent call to previous. Obeys the general contract of ListIterator.previousIndex.- Specified by:
previousIndex
in interfaceListIterator
- Returns:
- the index of the element that would be returned by a subsequent call to previous, or -1 if list iterator is at beginning of list
-
remove
public void remove()Removes from the list the last element that was returned by next or previous. Obeys the general contract of ListIterator.remove.- Specified by:
remove
in interfaceIterator
- Specified by:
remove
in interfaceListIterator
-
set
Replaces the last element returned by next or previous with the specified element. Obeys the general contract of ListIterator.set.- Specified by:
set
in interfaceListIterator
- Parameters:
o
- the element with which to replace the last element returned by next or previous- Throws:
ClassCastException
- if the class of the specified element prevents it from being added to this list
-
add
Inserts the specified element into the list. Obeys the general contract of ListIterator.add.- Specified by:
add
in interfaceListIterator
- Parameters:
o
- the element to insert- Throws:
ClassCastException
- if the class of the specified element prevents it from being added to this ListIterator
-
checkObject
Check the passed object to verify that it passes the restriction of this ListIterator.- Parameters:
o
- the Object to check- Throws:
ClassCastException
- if the class of the passed Object prevents it from being stored in this ListIterator
-