Package com.tangosol.util
Class RestrictedCollections.RestrictedEntrySet
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.util.RestrictedCollections.RestrictedEntrySet
-
- All Implemented Interfaces:
Serializable,Iterable,Collection,Set
- Enclosing class:
- RestrictedCollections
public static class RestrictedCollections.RestrictedEntrySet extends Base implements Set, Serializable
A restricted Collection that requires its contents to be of a specified class.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classRestrictedCollections.RestrictedEntrySet.RestrictedEntryA Map Entry that restricts the key and value types.protected classRestrictedCollections.RestrictedEntrySet.RestrictedIteratorA Map Entry Iterator that restricts the key and value types.-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Constructor Summary
Constructors Constructor Description RestrictedEntrySet(Set set, Class clzKey, Class clzVal)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Object o)Ensures that this Collection contains the specified element.booleanaddAll(Collection col)Adds all of the elements in the specified Collection to this Collection (optional operation).protected voidcheckValue(Object o)Check the passed object to verify that it passes the "value" restriction of this Map.voidclear()Removes all of the elements from this Collection.booleancontains(Object o)Returns true if this Collection contains the specified element.booleancontainsAll(Collection col)Returns true if this Collection contains all of the elements in the specified Collection.booleanequals(Object o)Compares the specified object with this collection for equality.inthashCode()Returns the hash code value for this collection.booleanisEmpty()Returns true if this Collection contains no elements.Iteratoriterator()Returns an Iterator over the elements contained in this Collection.booleanremove(Object o)Removes a single instance of the specified element from this Collection, if it is present (optional operation).booleanremoveAll(Collection col)Removes all this Collection's elements that are also contained in the specified Collection (optional operation).booleanretainAll(Collection col)Retains only the elements in this Collection that are contained in the specified Collection (optional operation).intsize()Returns the number of elements in this Collection.Object[]toArray()Returns an array containing all of the elements in this Collection.Object[]toArray(Object[] ao)Returns an array containing all of the elements in this Collection whose runtime type is that of the specified array.StringtoString()Return a String description for this collection.protected Map.EntrywrapEntry(Map.Entry entry)Wrap an Entry from the Entry Set to make a Restricted Entry.protected IteratorwrapIterator(Iterator iter)Wrap an Iterator from the Entry Set to make a Restricted Iterator.-
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, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
spliterator
-
-
-
-
Method Detail
-
size
public int size()
Returns the number of elements in this Collection.- Specified by:
sizein interfaceCollection- Specified by:
sizein interfaceSet- Returns:
- the number of elements in this Collection
-
isEmpty
public boolean isEmpty()
Returns true if this Collection contains no elements.- Specified by:
isEmptyin interfaceCollection- Specified by:
isEmptyin interfaceSet- Returns:
- true if this Collection contains no elements
-
contains
public boolean contains(Object o)
Returns true if this Collection contains the specified element. More formally, returns true if and only if this Collection contains at least one elementesuch that(o==null ? e==null : o.equals(e)).- Specified by:
containsin interfaceCollection- Specified by:
containsin interfaceSet- Parameters:
o- the object to search for in the Collection- Returns:
- true if this Collection contains the specified object
-
iterator
public Iterator iterator()
Returns an Iterator over the elements contained in this Collection.
-
toArray
public Object[] toArray()
Returns an array containing all of the elements in this Collection. Obeys the general contract of Collection.toArray.- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceSet- Returns:
- an array, whose component type is the class of objects that may be stored in the Collection containing all of the elements in this Collection
-
toArray
public Object[] toArray(Object[] ao)
Returns an array containing all of the elements in this Collection whose runtime type is that of the specified array. Obeys the general contract of Collection.toArray.- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceSet- Parameters:
ao- the array into which the elements of this Collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose- Returns:
- an array containing the elements of this Collection
-
add
public boolean add(Object o)
Ensures that this Collection contains the specified element.- Specified by:
addin interfaceCollection- Specified by:
addin interfaceSet- Parameters:
o- element whose presence in this Collection is to be ensured- Returns:
- true if the Collection changed as a result of the call
-
remove
public boolean remove(Object o)
Removes a single instance of the specified element from this Collection, if it is present (optional operation). More formally, removes an elementesuch that(o==null ? e==null : o.equals(e)), if the Collection contains one or more such elements. Returns true if the Collection contained the specified element (or equivalently, if the Collection changed as a result of the call).- Specified by:
removein interfaceCollection- Specified by:
removein interfaceSet- Parameters:
o- element to be removed from this Collection, if present- Returns:
- true if the Collection contained the specified element
-
containsAll
public boolean containsAll(Collection col)
Returns true if this Collection contains all of the elements in the specified Collection.- Specified by:
containsAllin interfaceCollection- Specified by:
containsAllin interfaceSet- Parameters:
col- Collection to be checked for containment in this Collection- Returns:
- true if this Collection contains all of the elements in the specified Collection
-
addAll
public boolean addAll(Collection col)
Adds all of the elements in the specified Collection to this Collection (optional operation). The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this Collection, and this Collection is nonempty.)- Specified by:
addAllin interfaceCollection- Specified by:
addAllin interfaceSet- Parameters:
col- elements to be inserted into this Collection- Returns:
- true if this Collection changed as a result of the call
-
removeAll
public boolean removeAll(Collection col)
Removes all this Collection's elements that are also contained in the specified Collection (optional operation). After this call returns, this Collection will contain no elements in common with the specified Collection.- Specified by:
removeAllin interfaceCollection- Specified by:
removeAllin interfaceSet- Parameters:
col- elements to be removed from this Collection- Returns:
- true if this Collection changed as a result of the call
-
retainAll
public boolean retainAll(Collection col)
Retains only the elements in this Collection that are contained in the specified Collection (optional operation). In other words, removes from this Collection all of its elements that are not contained in the specified Collection.- Specified by:
retainAllin interfaceCollection- Specified by:
retainAllin interfaceSet- Parameters:
col- elements to be retained in this Collection- Returns:
- true if this Collection changed as a result of the call
-
clear
public void clear()
Removes all of the elements from this Collection.- Specified by:
clearin interfaceCollection- Specified by:
clearin interfaceSet
-
equals
public boolean equals(Object o)
Compares the specified object with this collection for equality.Obeys the general contract of Collection.equals.
-
hashCode
public int hashCode()
Returns the hash code value for this collection. Obeys the general contract of Collection.hashCode.
-
toString
public String toString()
Return a String description for this collection.
-
checkValue
protected void checkValue(Object o)
Check the passed object to verify that it passes the "value" restriction of this Map.- Parameters:
o- the Object to check- Throws:
ClassCastException- if the class of the passed Object prevents it from being used as a value in this Map
-
wrapEntry
protected Map.Entry wrapEntry(Map.Entry entry)
Wrap an Entry from the Entry Set to make a Restricted Entry.- Parameters:
entry- a Map Entry to wrap- Returns:
- a Map Entry that restricts its type
-
-