Class UnmodifiableSet<E>
- java.lang.Object
-
- org.apache.openjpa.lib.util.collections.AbstractCollectionDecorator<E>
-
- org.apache.openjpa.lib.util.collections.AbstractSetDecorator<E>
-
- org.apache.openjpa.lib.util.collections.AbstractSerializableSetDecorator<E>
-
- org.apache.openjpa.lib.util.collections.UnmodifiableSet<E>
-
- Type Parameters:
E- the type of the elements in this set
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>,Unmodifiable
public final class UnmodifiableSet<E> extends AbstractSerializableSetDecorator<E> implements Unmodifiable
Decorates anotherSetto ensure it can't be altered.This class is Serializable from Commons Collections 3.1.
Attempts to modify it will result in an UnsupportedOperationException.
- Since:
- 3.0
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E object)booleanaddAll(java.util.Collection<? extends E> coll)voidclear()java.util.Iterator<E>iterator()booleanremove(java.lang.Object object)booleanremoveAll(java.util.Collection<?> coll)booleanremoveIf(java.util.function.Predicate<? super E> filter)booleanretainAll(java.util.Collection<?> coll)static <E> java.util.Set<E>unmodifiableSet(java.util.Set<? extends E> set)Factory method to create an unmodifiable set.-
Methods inherited from class org.apache.openjpa.lib.util.collections.AbstractSetDecorator
decorated, equals, hashCode
-
Methods inherited from class org.apache.openjpa.lib.util.collections.AbstractCollectionDecorator
contains, containsAll, isEmpty, setCollection, size, toArray, toArray, toString
-
-
-
-
Method Detail
-
unmodifiableSet
public static <E> java.util.Set<E> unmodifiableSet(java.util.Set<? extends E> set)
Factory method to create an unmodifiable set.- Type Parameters:
E- the element type- Parameters:
set- the set to decorate, must not be null- Returns:
- a new unmodifiable set
- Throws:
java.lang.NullPointerException- if set is null- Since:
- 4.0
-
iterator
public java.util.Iterator<E> iterator()
-
add
public boolean add(E object)
- Specified by:
addin interfacejava.util.Collection<E>- Specified by:
addin interfacejava.util.Set<E>- Overrides:
addin classAbstractCollectionDecorator<E>
-
addAll
public boolean addAll(java.util.Collection<? extends E> coll)
- Specified by:
addAllin interfacejava.util.Collection<E>- Specified by:
addAllin interfacejava.util.Set<E>- Overrides:
addAllin classAbstractCollectionDecorator<E>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<E>- Specified by:
clearin interfacejava.util.Set<E>- Overrides:
clearin classAbstractCollectionDecorator<E>
-
remove
public boolean remove(java.lang.Object object)
- Specified by:
removein interfacejava.util.Collection<E>- Specified by:
removein interfacejava.util.Set<E>- Overrides:
removein classAbstractCollectionDecorator<E>
-
removeIf
public boolean removeIf(java.util.function.Predicate<? super E> filter)
- Specified by:
removeIfin interfacejava.util.Collection<E>- Overrides:
removeIfin classAbstractCollectionDecorator<E>- Since:
- 4.4
-
removeAll
public boolean removeAll(java.util.Collection<?> coll)
- Specified by:
removeAllin interfacejava.util.Collection<E>- Specified by:
removeAllin interfacejava.util.Set<E>- Overrides:
removeAllin classAbstractCollectionDecorator<E>
-
retainAll
public boolean retainAll(java.util.Collection<?> coll)
- Specified by:
retainAllin interfacejava.util.Collection<E>- Specified by:
retainAllin interfacejava.util.Set<E>- Overrides:
retainAllin classAbstractCollectionDecorator<E>
-
-