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
Fields Modifier and Type Field Description protected Classm_clzThe class of Objects stored in the ListIterator.protected ListIteratorm_iterThe underlying ListIterator.
-
Constructor Summary
Constructors Constructor Description RestrictedListIterator(ListIterator iter, Class clz)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Object o)Inserts the specified element into the list.protected voidcheckObject(Object o)Check the passed object to verify that it passes the restriction of this ListIterator.booleanhasNext()Returns true if this list iterator has more elements when traversing the list in the forward direction.booleanhasPrevious()Returns true if this list iterator has more elements when traversing the list in the reverse direction.Objectnext()Returns the next element in the list.intnextIndex()Returns the index of the element that would be returned by a subsequent call to next.Objectprevious()Returns the previous element in the list.intpreviousIndex()Returns the index of the element that would be returned by a subsequent call to previous.voidremove()Removes from the list the last element that was returned by next or previous.voidset(Object o)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, newHashMap, newHashMap, newHashSet, newHashSet, 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 Detail
-
m_iter
protected ListIterator m_iter
The underlying ListIterator.
-
m_clz
protected Class m_clz
The class of Objects stored in the ListIterator.
-
-
Constructor Detail
-
RestrictedListIterator
public RestrictedListIterator(ListIterator iter, Class clz)
Constructor.- Parameters:
iter- the underlying ListIteratorclz- the class of objects that may be stored in the ListIterator
-
-
Method Detail
-
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:
hasNextin interfaceIterator- Specified by:
hasNextin interfaceListIterator- Returns:
- true if the list iterator has more elements when traversing the list in the forward direction
-
next
public Object next()
Returns the next element in the list. Obeys the general contract of ListIterator.next.- Specified by:
nextin interfaceIterator- Specified by:
nextin 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:
hasPreviousin interfaceListIterator- Returns:
- true if the list iterator has more elements when traversing the list in the reverse direction
-
previous
public Object previous()
Returns the previous element in the list. Obeys the general contract of ListIterator.previous.- Specified by:
previousin 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:
nextIndexin 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:
previousIndexin 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:
removein interfaceIterator- Specified by:
removein interfaceListIterator
-
set
public void set(Object o)
Replaces the last element returned by next or previous with the specified element. Obeys the general contract of ListIterator.set.- Specified by:
setin 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
public void add(Object o)
Inserts the specified element into the list. Obeys the general contract of ListIterator.add.- Specified by:
addin 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
protected void checkObject(Object o)
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
-
-