E - public interface Fifo<E>
SimpleFifo is threadsafe;
explicitly single-threaded environments may want to override this
in places where a Fifo is injected (core libraries just use new SimpleFifo).
GWT just uses an overlay on a native [] to implement fifo.
This collection will only throw exceptions if you are doing something illegal,
like using Iterator.remove() before calling .next().
null adds are silently ignored,
and take() will only return null if the fifo is drained.
This is so subclasses can override isEmpty() to return false until a
given resource is closed, or a set of Future<>s complete.
take() can return null while isEmpty return false.| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all items in the queue.
|
boolean |
contains(E item)
Check if this queue contains the given item.
|
Iterable<E> |
forEach() |
Fifo<E> |
give(E item)
Analagous to add(), however, we do not use the standard naming convention,
to avoid interface clashes with adapter types in collection libraries
that may wish to override our Fifo with their own type.
|
Fifo<E> |
giveAll(E... elements)
Analagous to addAll(), however, we avoid the standard naming convention,
so we can provide a fluent, strongly typed api.
|
Fifo<E> |
giveAll(Iterable<E> elements)
Analagous to addAll(), however, we avoid the standard naming convention,
so we can provide a fluent, strongly typed api.
|
boolean |
isEmpty()
Fastest way to tell if the queue is drained.
|
Iterator<E> |
iterator() |
String |
join(String delim) |
boolean |
remove(E item)
Manually remove the item from queue.
|
int |
size()
Return a count of items in the queue.
|
E |
take()
Analagous to poll(); retrieves and removes head.
|
Fifo<E> give(E item)
item - - The item to add to end of queue.Fifo<E> giveAll(E... elements)
elements - - Varags or array adapters for bulk add.Fifo<E> giveAll(Iterable<E> elements)
elements - - Any collection or custom iterable adapters (like blocking / async).E take()
boolean isEmpty()
boolean contains(E item)
item - boolean remove(E item)
item - int size()
void clear()
Iterator<E> iterator()
Iterable<E> forEach()
Copyright © December 07, 2012–2015 The Internet Party. All rights reserved.