public final class UnmodifiableQueue<E> extends AbstractQueueDecorator<E> implements Unmodifiable
Queue
to ensure it can't be altered.
Attempts to modify it will result in an UnsupportedOperationException.
Modifier and Type | Method and Description |
---|---|
boolean |
add(Object object) |
boolean |
addAll(Collection<? extends E> coll) |
void |
clear() |
Iterator<E> |
iterator() |
boolean |
offer(E obj) |
E |
poll() |
E |
remove() |
boolean |
remove(Object object) |
boolean |
removeAll(Collection<?> coll) |
boolean |
retainAll(Collection<?> coll) |
static <E> Queue<E> |
unmodifiableQueue(Queue<? extends E> queue)
Factory method to create an unmodifiable queue.
|
decorated, element, peek
contains, containsAll, equals, hashCode, isEmpty, setCollection, size, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, isEmpty, size, toArray, toArray
public static <E> Queue<E> unmodifiableQueue(Queue<? extends E> queue)
If the queue passed in is already unmodifiable, it is returned.
E
- the type of the elements in the queuequeue
- the queue to decorate, must not be nullIllegalArgumentException
- if queue is nullpublic Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollectionDecorator<E>
public boolean add(Object object)
add
in interface Collection<E>
add
in interface Queue<E>
add
in class AbstractCollectionDecorator<E>
public boolean addAll(Collection<? extends E> coll)
addAll
in interface Collection<E>
addAll
in class AbstractCollectionDecorator<E>
public void clear()
clear
in interface Collection<E>
clear
in class AbstractCollectionDecorator<E>
public boolean remove(Object object)
remove
in interface Collection<E>
remove
in class AbstractCollectionDecorator<E>
public boolean removeAll(Collection<?> coll)
removeAll
in interface Collection<E>
removeAll
in class AbstractCollectionDecorator<E>
public boolean retainAll(Collection<?> coll)
retainAll
in interface Collection<E>
retainAll
in class AbstractCollectionDecorator<E>
public boolean offer(E obj)
public E poll()
Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.