Set to ensure it can't be altered.
Attempts to modify it will result in an UnsupportedOperationException.
| Modifier and Type | Class and Description |
|---|---|
| private class | UnmodifiableEntrySet.UnmodifiableEntry
Implementation of a map entry that is unmodifiable. |
| private class | UnmodifiableEntrySet.UnmodifiableEntrySetIterator
Implementation of an entry set iterator. |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| private | UnmodifiableEntrySet(final Set<Map.
the set to decorate, must not be null setConstructor that wraps (not copies). |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(final Map.
element to be added to this set objectOverrides org. Implements java. |
| public boolean | addAll(final Collection<? extends Map.
collection containing elements to be added to this set coll)Overrides org. Implements java. |
| public void | clear()
Overrides org. Implements java. |
| public Iterator | iterator()
Overrides org. Implements java. |
| public boolean | remove(final Object
object to be removed from this set, if present object)Overrides org. Implements java. |
| public boolean | removeAll(final Collection<?>
collection containing elements to be removed from this set coll)Overrides org. Implements java. |
| public boolean | removeIf(Predicate<? super Map.
a predicate which returns filter)true for elements to be
removedOverrides org. Overrides default java. |
| public boolean | retainAll(final Collection<?>
collection containing elements to be retained in this set coll)Overrides org. Implements java. |
| public Object[] | toArray()
Overrides org. Implements java. |
| public <T> T[] | toArray(final T[]
the array into which the elements of this set are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose. array)Overrides org. Implements java. |
| public static < the key type K, the value type V> Set | Returns: a new unmodifiable entry setthe set to decorate, must not be null setFactory method to create an unmodifiable set of Map Entry objects. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serialization version | |
| UnmodifiableEntrySet | back to summary |
|---|---|
| private UnmodifiableEntrySet(final Set<Map. Constructor that wraps (not copies).
| |
| add | back to summary |
|---|---|
| public boolean add(final Map. Overrides org. Implements java. Doc from java. Adds the specified element to this set if it is not already present
(optional operation). More formally, adds the specified element
The stipulation above does not imply that sets must accept all
elements; sets may refuse to add any particular element, including
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(final Collection<? extends Map. Overrides org. Implements java. Doc from java. Adds all of the elements in the specified collection to this set if
they're not already present (optional operation). If the specified
collection is also a set, the
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides org. Implements java. Doc from java. Removes all of the elements from this set (optional operation). The set will be empty after this call returns.
| |
| iterator | back to summary |
|---|---|
| public Iterator Overrides org. Implements java. Doc from java. Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee). | |
| remove | back to summary |
|---|---|
| public boolean remove(final Object object) Overrides org. Implements java. Doc from java. Removes the specified element from this set if it is present
(optional operation). More formally, removes an element | |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(final Collection<?> coll) Overrides org. Implements java. Doc from java. Removes from this set all of its elements that are contained in the specified collection (optional operation). If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.
| |
| removeIf | back to summary |
|---|---|
| public boolean removeIf(Predicate<? super Map. Overrides org. Overrides default java. Doc from java. Removes all of the elements of this collection that satisfy the given predicate. Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller. | |
| retainAll | back to summary |
|---|---|
| public boolean retainAll(final Collection<?> coll) Overrides org. Implements java. Doc from java. Retains only the elements in this set that are contained in the specified collection (optional operation). In other words, removes from this set all of its elements that are not contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the intersection of the two sets.
| |
| toArray | back to summary |
|---|---|
| public Object[] toArray() Overrides org. Implements java. Doc from java. Returns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array will be "safe" in that no references to it are maintained by this set. (In other words, this method must allocate a new array even if this set is backed by an array). The caller is thus free to modify the returned array. This method acts as bridge between array-based and collection-based APIs.
| |
| toArray | back to summary |
|---|---|
| public <T> T[] toArray(final T[] array) Overrides org. Implements java. Doc from java. Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this set. If this set fits in the specified array with room to spare
(i.e., the array has more elements than this set), the element in
the array immediately following the end of the set is set to
If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. Like the Suppose
String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to
toArray().
| |
| unmodifiableEntrySet | back to summary |
|---|---|
| public static <K, V> Set Factory method to create an unmodifiable set of Map Entry objects. | |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public V | setValue(final V
new value to be stored in this entry obj)Overrides org. Implements java. |
| UnmodifiableEntry | back to summary |
|---|---|
| protected UnmodifiableEntry(final Map. | |
| setValue | back to summary |
|---|---|
| public V setValue(final V obj) Overrides org. Implements java. Doc from java. Replaces the value corresponding to this entry with the specified
value (optional operation). (Writes through to the map.) The
behavior of this call is undefined if the mapping has already been
removed from the map (by the iterator's
| |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Map. | next()
Overrides org. Implements java. |
| public void | remove()
Overrides org. Overrides default java. |
| UnmodifiableEntrySetIterator | back to summary |
|---|---|
| protected UnmodifiableEntrySetIterator(final Iterator<Map. | |
| next | back to summary |
|---|---|
| public Map. Overrides org. Implements java. Doc from org. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides org. Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |