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:
Serializable,Iterable<E>,Collection<E>,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(Collection<? extends E> coll)voidclear()Iterator<E>iterator()booleanremove(Object object)booleanremoveAll(Collection<?> coll)booleanremoveIf(Predicate<? super E> filter)booleanretainAll(Collection<?> coll)static <E> Set<E>unmodifiableSet(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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.Set
contains, containsAll, isEmpty, size, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
unmodifiableSet
public static <E> Set<E> unmodifiableSet(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:
NullPointerException- if set is null- Since:
- 4.0
-
add
public boolean add(E object)
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollectionDecorator<E>
-
addAll
public boolean addAll(Collection<? extends E> coll)
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceSet<E>- Overrides:
addAllin classAbstractCollectionDecorator<E>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classAbstractCollectionDecorator<E>
-
remove
public boolean remove(Object object)
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classAbstractCollectionDecorator<E>
-
removeIf
public boolean removeIf(Predicate<? super E> filter)
- Specified by:
removeIfin interfaceCollection<E>- Overrides:
removeIfin classAbstractCollectionDecorator<E>- Since:
- 4.4
-
removeAll
public boolean removeAll(Collection<?> coll)
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classAbstractCollectionDecorator<E>
-
retainAll
public boolean retainAll(Collection<?> coll)
- Specified by:
retainAllin interfaceCollection<E>- Specified by:
retainAllin interfaceSet<E>- Overrides:
retainAllin classAbstractCollectionDecorator<E>
-
-