E - the type of elements held in this collectionpublic abstract class AbstractOfferable<E> extends AbstractCollection<E> implements Offerable<E>
Offerable operations. The implementations in this class
are appropriate when the base implementation does not allow null elements. Method add
is based on offer, but throws exceptions instead of indicating failure via false or
null returns.
An Offerable implementation that extends this class must minimally define a method Queue.offer(E) which
does not permit insertion of null elements, along with methods Collection.size(), and
Collection.iterator(). Typically, additional methods will be overridden as well. If these requirements cannot
be met, consider instead subclassing AbstractCollection.
| Constructor and Description |
|---|
AbstractOfferable() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity
restrictions, returning
true upon success and throwing an IllegalStateException if no space is
currently available. |
boolean |
addAll(Collection<? extends E> c)
Adds all of the elements in the specified collection to this queue.
|
clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitoffer, offer, put, remainingCapacityequals, hashCode, parallelStream, removeIf, spliterator, streampublic boolean add(E e)
Offerabletrue upon success and throwing an IllegalStateException if no space is
currently available.add in interface Offerable<E>add in interface Collection<E>add in class AbstractCollection<E>e - the element to addtrue (as specified by Collection.add(E))public boolean addAll(Collection<? extends E> c)
This implementation iterates over the specified collection, and adds each element returned by the iterator to this queue, in turn. A runtime exception encountered while trying to add an element (including, in particular, a null element) may result in only some of the elements having been successfully added when the associated exception is thrown.
addAll in interface Collection<E>addAll in class AbstractCollection<E>c - collection containing elements to be added to this queueClassCastException - if the class of an element of the specified collection prevents it from being added to this queueNullPointerException - if the specified collection contains a null element and this queue does not permit null elements, or
if the specified collection is nullIllegalArgumentException - if some property of an element of the specified collection prevents it from being added to this
queue, or if the specified collection is this queueIllegalStateException - if not all the elements can be added at this time due to insertion restrictionsadd(Object)Copyright © 2022 Internet2. All rights reserved.