Package com.hazelcast.jet.core
Interface Inbox
- All Known Implementing Classes:
- TestInbox
A subset of 
Queue<Object> API restricted to the consumer side,
 with additional support for bulk draining operations.- Since:
- Jet 3.0
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Removes all items from the inbox.default <E> intPasses each of this object's items to the supplied consumer until it is empty.default <E> intdrainTo(Collection<E> target) Drains all elements into the providedCollection.default <E> intdrainTo(Collection<E> target, int limit) Drains at mostlimitelements into the providedCollection.default <E,M> int drainTo(Collection<M> target, int limit, Function<E, M> mapper) Drains and maps at mostlimitelements into the providedCollection.booleanisEmpty()Returnstrueif this inbox contains no elements,falseotherwise.iterator()Returns an iterator over the items in the inbox in the order they would be returned by thepoll()method.peek()Retrieves, but does not remove, the head of this inbox, or returnsnullif it is empty.poll()Retrieves and removes the head of this inbox, or returnsnullif it is empty.voidremove()Removes the head of this inbox.intsize()Returns the number of objects in the inbox.Methods inherited from interface java.lang.IterableforEach, spliterator
- 
Method Details- 
isEmptyboolean isEmpty()Returnstrueif this inbox contains no elements,falseotherwise.
- 
peekRetrieves, but does not remove, the head of this inbox, or returnsnullif it is empty.
- 
pollRetrieves and removes the head of this inbox, or returnsnullif it is empty.
- 
removevoid remove()Removes the head of this inbox. This method throws an exception if the inbox is empty.- Throws:
- NoSuchElementException- if this inbox is empty
 
- 
iteratorReturns an iterator over the items in the inbox in the order they would be returned by thepoll()method.The returned iterator doesn't support the Iterator.remove()method.
- 
clearvoid clear()Removes all items from the inbox.
- 
drainToDrains all elements into the providedCollection.- Parameters:
- target- the collection to drain this object's items into
- Returns:
- the number of elements actually drained
 
- 
drainToDrains at mostlimitelements into the providedCollection.- Parameters:
- target- the collection to drain this object's items into
- limit- the maximum amount of items to drain
- Returns:
- the number of elements actually drained
- Since:
- Jet 4.0
 
- 
drainToDrains and maps at mostlimitelements into the providedCollection.- Parameters:
- target- the collection to drain this object's items into
- limit- the maximum amount of items to drain
- mapper- mapping function to apply to this object's items
- Returns:
- the number of elements actually drained
- Since:
- Jet 4.1
 
- 
drainPasses each of this object's items to the supplied consumer until it is empty.- Returns:
- the number of elements drained
 
- 
sizeint size()Returns the number of objects in the inbox.
 
-