Class UnmodifiableQueue<E>
java.lang.Object
org.apache.commons.collections4.collection.AbstractCollectionDecorator<E>
org.apache.commons.collections4.queue.AbstractQueueDecorator<E>
org.apache.commons.collections4.queue.UnmodifiableQueue<E>
- Type Parameters:
E- The type of elements held in this queue
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Queue<E>,Unmodifiable
Decorates another
Queue to ensure it can't be altered.
Attempts to modify it will result in an UnsupportedOperationException.
- Since:
- 4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAlways throwsUnsupportedOperationException.booleanaddAll(Collection<? extends E> coll) Always throwsUnsupportedOperationException.voidclear()Always throwsUnsupportedOperationException.iterator()booleanAlways throwsUnsupportedOperationException.poll()Always throwsUnsupportedOperationException.remove()Always throwsUnsupportedOperationException.booleanAlways throwsUnsupportedOperationException.booleanremoveAll(Collection<?> coll) Always throwsUnsupportedOperationException.booleanAlways throwsUnsupportedOperationException.booleanretainAll(Collection<?> coll) Always throwsUnsupportedOperationException.static <E> Queue<E> unmodifiableQueue(Queue<? extends E> queue) Factory method to create an unmodifiable queue.Methods inherited from class org.apache.commons.collections4.queue.AbstractQueueDecorator
decorated, element, peekMethods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecorator
contains, containsAll, isEmpty, setCollection, size, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
contains, containsAll, equals, hashCode, isEmpty, parallelStream, size, spliterator, stream, toArray, toArray
-
Method Details
-
unmodifiableQueue
Factory method to create an unmodifiable queue.If the queue passed in is already unmodifiable, it is returned.
- Type Parameters:
E- The type of the elements in the queue- Parameters:
queue- The queue to decorate, must not be null- Returns:
- An unmodifiable Queue
- Throws:
NullPointerException- if queue is null
-
add
Always throwsUnsupportedOperationException.- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceQueue<E>- Overrides:
addin classAbstractCollectionDecorator<E>- Parameters:
object- Ignored.- Throws:
UnsupportedOperationException- Always thrown.
-
addAll
Always throwsUnsupportedOperationException.- Specified by:
addAllin interfaceCollection<E>- Overrides:
addAllin classAbstractCollectionDecorator<E>- Parameters:
coll- Ignored.- Throws:
UnsupportedOperationException- Always thrown.
-
clear
Always throwsUnsupportedOperationException.- Specified by:
clearin interfaceCollection<E>- Overrides:
clearin classAbstractCollectionDecorator<E>- Throws:
UnsupportedOperationException- Always thrown.
-
iterator
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Overrides:
iteratorin classAbstractCollectionDecorator<E>
-
offer
Always throwsUnsupportedOperationException.- Specified by:
offerin interfaceQueue<E>- Overrides:
offerin classAbstractQueueDecorator<E>- Parameters:
obj- Ignored.- Throws:
UnsupportedOperationException- Always thrown.
-
poll
Always throwsUnsupportedOperationException.- Specified by:
pollin interfaceQueue<E>- Overrides:
pollin classAbstractQueueDecorator<E>- Throws:
UnsupportedOperationException- Always thrown.
-
remove
Always throwsUnsupportedOperationException.- Specified by:
removein interfaceQueue<E>- Overrides:
removein classAbstractQueueDecorator<E>- Throws:
UnsupportedOperationException- Always thrown.
-
remove
Always throwsUnsupportedOperationException.- Specified by:
removein interfaceCollection<E>- Overrides:
removein classAbstractCollectionDecorator<E>- Parameters:
object- Ignored.- Throws:
UnsupportedOperationException- Always thrown.
-
removeAll
Always throwsUnsupportedOperationException.- Specified by:
removeAllin interfaceCollection<E>- Overrides:
removeAllin classAbstractCollectionDecorator<E>- Parameters:
coll- Ignored.- Throws:
UnsupportedOperationException- Always thrown.
-
removeIf
Always throwsUnsupportedOperationException.- Specified by:
removeIfin interfaceCollection<E>- Overrides:
removeIfin classAbstractCollectionDecorator<E>- Parameters:
filter- Ignored.- Throws:
UnsupportedOperationException- Always thrown.- Since:
- 4.4
-
retainAll
Always throwsUnsupportedOperationException.- Specified by:
retainAllin interfaceCollection<E>- Overrides:
retainAllin classAbstractCollectionDecorator<E>- Parameters:
coll- Ignored.- Throws:
UnsupportedOperationException- Always thrown.
-