Package com.tangosol.util
Class RestrictedCollections.RestrictedList
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.RestrictedCollections.RestrictedCollection
com.tangosol.util.RestrictedCollections.RestrictedList
- All Implemented Interfaces:
Serializable
,Iterable
,Collection
,List
,SequencedCollection
- Enclosing class:
RestrictedCollections
public static class RestrictedCollections.RestrictedList
extends RestrictedCollections.RestrictedCollection
implements List, Serializable
A restricted List that requires its contents to be of a
specified class.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Fields inherited from class com.tangosol.util.RestrictedCollections.RestrictedCollection
m_clz, m_col
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts the specified element at the specified position in this list (optional operation).boolean
addAll
(int index, Collection col) Inserts all of the elements in the specified collection into this list at the specified position (optional operation).get
(int index) Returns the element at the specified position in this list.int
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.int
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.Returns a list iterator of the elements in this list (in proper sequence).listIterator
(int index) Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.remove
(int index) Removes the element at the specified position in this list (optional operation).Replaces the element at the specified position in this list with the specified element (optional operation).subList
(int fromIndex, int toIndex) Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.Methods inherited from class com.tangosol.util.RestrictedCollections.RestrictedCollection
add, addAll, checkObject, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
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, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
RestrictedList
Constructor.- Parameters:
list
- the underlying Listclz
- the class of objects that may be stored in the List
-
-
Method Details
-
get
Returns the element at the specified position in this list. -
set
Replaces the element at the specified position in this list with the specified element (optional operation).- Specified by:
set
in interfaceList
- Parameters:
index
- index of element to replace.element
- element to be stored at the specified position.- Returns:
- the element previously at the specified position.
- Throws:
ClassCastException
- if the class of the specified element prevents it from being added to this list
-
add
Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Specified by:
add
in interfaceList
- Parameters:
index
- index at which the specified element is to be insertedelement
- element to be inserted- Throws:
ClassCastException
- if the class of the specified element prevents it from being added to this list
-
addAll
Inserts all of the elements in the specified collection into this list at the specified position (optional operation).- Specified by:
addAll
in interfaceList
- Parameters:
index
- index at which to insert first element from the specified collectioncol
- elements to be inserted into this list- Returns:
- true if this list changed as a result of the call
- Throws:
ClassCastException
- if the class of one of elements of the specified collection prevents it from being added to this list
-
remove
Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list. -
indexOf
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index. -
lastIndexOf
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.- Specified by:
lastIndexOf
in interfaceList
- Parameters:
o
- element to search for- Returns:
- the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.
-
listIterator
Returns a list iterator of the elements in this list (in proper sequence).- Specified by:
listIterator
in interfaceList
- Returns:
- a list iterator of the elements in this list (in proper sequence)
-
listIterator
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. The specified index indicates the first element that would be returned by an initial call to the next method. An initial call to the previous method would return the element with the specified index minus one.- Specified by:
listIterator
in interfaceList
- Parameters:
index
- index of first element to be returned from the list iterator (by a call to the next method)- Returns:
- a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list
-
subList
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. Obeys the general contract of List.subList.
-