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
- 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:
- Serialized Form
-
-
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
Constructors Constructor Description RestrictedList(List list, Class clz)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, Object element)
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).Object
get(int index)
Returns the element at the specified position in this list.int
indexOf(Object o)
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
lastIndexOf(Object o)
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
listIterator()
Returns a list iterator of the elements in this list (in proper sequence).ListIterator
listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.Object
remove(int index)
Removes the element at the specified position in this list (optional operation).Object
set(int index, Object element)
Replaces the element at the specified position in this list with the specified element (optional operation).List
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
-
-
-
-
Method Detail
-
get
public Object get(int index)
Returns the element at the specified position in this list.
-
set
public Object set(int index, Object element)
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
public void add(int index, Object element)
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
public boolean addAll(int index, Collection col)
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
public Object remove(int index)
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
public int indexOf(Object o)
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
public int lastIndexOf(Object o)
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
public ListIterator 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
public ListIterator listIterator(int index)
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
public List subList(int fromIndex, int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. Obeys the general contract of List.subList.
-
-