GNU Classpath (0.99.1-pre) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
java.util.concurrent.SynchronousQueue<E>
Collection
and Iterator
interfaces.
This class is a member of the
../../../../technotes/guides/collections/index.html">
Java Collections Framework.
Constructor Summary | |
| |
|
Method Summary | |
|
|
void |
|
boolean | |
boolean |
|
int |
|
int |
|
boolean |
|
Iterator |
|
boolean |
|
boolean | |
E |
|
E |
|
E | |
void |
|
int |
|
boolean | |
boolean |
|
boolean |
|
int |
|
E |
|
Object[] |
|
Methods inherited from class java.util.AbstractCollection<E> | |
T[] toArray , add , addAll , clear , contains , containsAll , isEmpty , iterator , remove , removeAll , retainAll , size , toArray , toString |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public SynchronousQueue(boolean fair)
Creates a SynchronousQueue with the specified fairness policy.
- Parameters:
fair
- if true, waiting threads contend in FIFO order for access; otherwise the order is unspecified.
publicT[] toArray(T[] a)
Sets the zeroeth element of the specified array to null (if the array has non-zero length) and returns it.
- Specified by:
- T[] toArray in interface Collection<E>
- Overrides:
- T[] toArray in interface AbstractCollection<E>
- Parameters:
a
- the array
- Returns:
- the specified array
- Throws:
NullPointerException
- if the specified array is null
public void clear()
Does nothing. A SynchronousQueue has no internal capacity.
- Specified by:
- clear in interface Collection<E>
- Overrides:
- clear in interface AbstractQueue<E>
public boolean contains(Object o)
Always returns false. A SynchronousQueue has no internal capacity.
- Specified by:
- contains in interface BlockingQueue<E>
- contains in interface Collection<E>
- Overrides:
- contains in interface AbstractCollection<E>
- Parameters:
o
- the element
- Returns:
- false
public boolean containsAll(Collection> c)
Returns false unless the given collection is empty. A SynchronousQueue has no internal capacity.
- Specified by:
- containsAll in interface Collection<E>
- Overrides:
- containsAll in interface AbstractCollection<E>
- Parameters:
c
- the collection
- Returns:
- false unless given collection is empty
public boolean isEmpty()
Always returns true. A SynchronousQueue has no internal capacity.
- Specified by:
- isEmpty in interface Collection<E>
- Overrides:
- isEmpty in interface AbstractCollection<E>
- Returns:
- true
public Iteratoriterator()
Returns an empty iterator in which hasNext always returns false.
- Specified by:
- iterator in interface Collection<E>
- iterator in interface Iterable<E>
- Overrides:
- iterator in interface AbstractCollection<E>
- Returns:
- an empty iterator
public boolean offer(E e)
Inserts the specified element into this queue, if another thread is waiting to receive it.
- Specified by:
- offer in interface BlockingQueue<E>
- offer in interface Queue<E>
- Parameters:
e
- the element to add
- Returns:
- true if the element was added to this queue, else false
- Throws:
NullPointerException
- if the specified element is null
public boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException
Inserts the specified element into this queue, waiting if necessary up to the specified wait time for another thread to receive it.
- Specified by:
- offer in interface BlockingQueue<E>
- Returns:
- true if successful, or false if the specified waiting time elapses before a consumer appears.
- Throws:
InterruptedException
-NullPointerException
-
public E peek()
Always returns null. A SynchronousQueue does not return elements unless actively waited on.
- Returns:
- null
public E poll()
Retrieves and removes the head of this queue, if another thread is currently making an element available.
- Returns:
- the head of this queue, or null if no element is available.
public E poll(long timeout, TimeUnit unit) throws InterruptedException
Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time, for another thread to insert it.
- Specified by:
- poll in interface BlockingQueue<E>
- Returns:
- the head of this queue, or null if the specified waiting time elapses before an element is present.
- Throws:
InterruptedException
-
public void put(E o) throws InterruptedException
Adds the specified element to this queue, waiting if necessary for another thread to receive it.
- Specified by:
- put in interface BlockingQueue<E>
- Throws:
InterruptedException
-NullPointerException
-
public int remainingCapacity()
Always returns zero. A SynchronousQueue has no internal capacity.
- Specified by:
- remainingCapacity in interface BlockingQueue<E>
- Returns:
- zero.
public boolean remove(Object o)
Always returns false. A SynchronousQueue has no internal capacity.
- Specified by:
- remove in interface BlockingQueue<E>
- remove in interface Collection<E>
- Overrides:
- remove in interface AbstractCollection<E>
- Parameters:
o
- the element to remove
- Returns:
- false
public boolean removeAll(Collection> c)
Always returns false. A SynchronousQueue has no internal capacity.
- Specified by:
- removeAll in interface Collection<E>
- Overrides:
- removeAll in interface AbstractCollection<E>
- Parameters:
c
- the collection
- Returns:
- false
public boolean retainAll(Collection> c)
Always returns false. A SynchronousQueue has no internal capacity.
- Specified by:
- retainAll in interface Collection<E>
- Overrides:
- retainAll in interface AbstractCollection<E>
- Parameters:
c
- the collection
- Returns:
- false
public int size()
Always returns zero. A SynchronousQueue has no internal capacity.
- Specified by:
- size in interface Collection<E>
- Overrides:
- size in interface AbstractCollection<E>
- Returns:
- zero.
public E take() throws InterruptedException
Retrieves and removes the head of this queue, waiting if necessary for another thread to insert it.
- Specified by:
- take in interface BlockingQueue<E>
- Returns:
- the head of this queue
- Throws:
InterruptedException
-
public Object[] toArray()
Returns a zero-length array.
- Specified by:
- toArray in interface Collection<E>
- Overrides:
- toArray in interface AbstractCollection<E>
- Returns:
- a zero-length array
GNU Classpath (0.99.1-pre) |