Top Description Constructors Methods
org.pcollections

public abstract Class AbstractUnmodifiableSet<E>

extends AbstractSet<E>
Class Inheritance
Known Direct Subclasses
org.pcollections.OrderedPSet, org.pcollections.TreePSet, org.pcollections.MapPSet
Type Parameters
<E>
the type of elements maintained by this set
Imports
java.util.AbstractSet, .Collection, java.util.function.Predicate

A subclass of AbstractSet that overrides the various mutator methods to mark them as deprecated and unconditionally throw UnsupportedOperationException.
Author
Ran Ari-Gur
Since
3.2.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
add(final E
element to be added to this set
e
)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Deprecated Unsupported operation.

Adds the specified element to this set if it is not already present (optional operation).

public boolean
addAll(final Collection<? extends E>
collection containing elements to be added to this set
list
)

Overrides java.util.AbstractCollection.addAll.

Implements java.util.Set.addAll, java.util.Collection.addAll.

Deprecated Unsupported operation.

Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Deprecated Unsupported operation.

Removes all of the elements from this set (optional operation).

public boolean
remove(final Object
object to be removed from this set, if present
o
)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Deprecated Unsupported operation.

Removes the specified element from this set if it is present (optional operation).

public boolean
removeAll(final Collection<?>
collection containing elements to be removed from this set
list
)

Overrides java.util.AbstractSet.removeAll.

Implements java.util.Set.removeAll, java.util.Collection.removeAll.

Deprecated Unsupported operation.

Removes from this set all of its elements that are contained in the specified collection (optional operation).

public boolean
removeIf(final Predicate<? super E>
a predicate which returns true for elements to be removed
filter
)

Overrides default java.util.Collection.removeIf.

Deprecated Unsupported operation.

Removes all of the elements of this collection that satisfy the given predicate (optional operation).

public boolean
retainAll(final Collection<?>
collection containing elements to be retained in this set
list
)

Overrides java.util.AbstractCollection.retainAll.

Implements java.util.Set.retainAll, java.util.Collection.retainAll.

Deprecated Unsupported operation.

Retains only the elements in this set that are contained in the specified collection (optional operation).

Inherited from java.util.AbstractSet:
equalshashCode

Constructor Detail

AbstractUnmodifiableSetback to summary
public AbstractUnmodifiableSet()

Method Detail

addback to summary
public boolean add(final E e)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Doc from java.util.Set.add.

Deprecated

Unsupported operation.

Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element e to this set if the set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throw an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the elements that they may contain.

Parameters
e:E

element to be added to this set

Returns:boolean

true if this set did not already contain the specified element

Annotations
@Deprecated
@Override
Exceptions
UnsupportedOperationException:
always
addAllback to summary
public boolean addAll(final Collection<? extends E> list)

Overrides java.util.AbstractCollection.addAll.

Implements java.util.Set.addAll, java.util.Collection.addAll.

Doc from java.util.Set.addAll.

Deprecated

Unsupported operation.

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 addAll operation effectively modifies this set so that its value is the union of the two sets. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress.

Parameters
list:Collection<? extends E>

collection containing elements to be added to this set

Returns:boolean

true if this set changed as a result of the call

Annotations
@Deprecated
@Override
Exceptions
UnsupportedOperationException:
always
clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Doc from java.util.Set.clear.

Deprecated

Unsupported operation.

Removes all of the elements from this set (optional operation). The set will be empty after this call returns.

Annotations
@Deprecated
@Override
Exceptions
UnsupportedOperationException:
always
removeback to summary
public boolean remove(final Object o)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Doc from java.util.Set.remove.

Deprecated

Unsupported operation.

Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)

Parameters
o:Object

object to be removed from this set, if present

Returns:boolean

true if this set contained the specified element

Annotations
@Deprecated
@Override
Exceptions
UnsupportedOperationException:
always
removeAllback to summary
public boolean removeAll(final Collection<?> list)

Overrides java.util.AbstractSet.removeAll.

Implements java.util.Set.removeAll, java.util.Collection.removeAll.

Doc from java.util.AbstractSet.removeAll.

Deprecated

Unsupported operation.

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.

This implementation determines which is the smaller of this set and the specified collection, by invoking the size method on each. If this set has fewer elements, then the implementation iterates over this set, checking each element returned by the iterator in turn to see if it is contained in the specified collection. If it is so contained, it is removed from this set with the iterator's remove method. If the specified collection has fewer elements, then the implementation iterates over the specified collection, removing from this set each element returned by the iterator, using this set's remove method.

Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method.

Parameters
list:Collection<?>

collection containing elements to be removed from this set

Returns:boolean

true if this set changed as a result of the call

Annotations
@Deprecated
@Override
Exceptions
UnsupportedOperationException:
always
removeIfback to summary
public boolean removeIf(final Predicate<? super E> filter)

Overrides default java.util.Collection.removeIf.

Doc from java.util.Collection.removeIf.

Deprecated

Unsupported operation.

Removes all of the elements of this collection that satisfy the given predicate (optional operation). Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller.

Parameters
filter:Predicate<? super E>

a predicate which returns true for elements to be removed

Returns:boolean

true if any elements were removed

Annotations
@Deprecated
@Override
Exceptions
UnsupportedOperationException:
always
retainAllback to summary
public boolean retainAll(final Collection<?> list)

Overrides java.util.AbstractCollection.retainAll.

Implements java.util.Set.retainAll, java.util.Collection.retainAll.

Doc from java.util.Set.retainAll.

Deprecated

Unsupported operation.

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.

Parameters
list:Collection<?>

collection containing elements to be retained in this set

Returns:boolean

true if this set changed as a result of the call

Annotations
@Deprecated
@Override
Exceptions
UnsupportedOperationException:
always