com.hazelcast.jet.core

## Interface Inbox

- All Known Implementing Classes:
    TestInbox

      public interface Inbox

  A subset of `Queue<Object>` API restricted to the consumer side, with additional support for bulk draining operations.
  Since:
    3.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default <E> int` | `drain(Consumer<E> consumer)` Passes each of this object's items to the supplied consumer until it is empty.
    `default <E> int` | `drainTo(Collection<E> target)` Drains all elements into the provided `Collection`.
    `boolean` | `isEmpty()` Returns `true` if this inbox contains no elements, `false` otherwise.
    `Object` | `peek()` Retrieves, but does not remove, the head of this inbox, or returns `null` if it is empty.
    `Object` | `poll()` Retrieves and removes the head of this inbox, or returns `null` if it is empty.
    `void` | `remove()` Removes the head of this inbox.
    `int` | `size()` Returns the number of objects in the inbox.

- - ### Method Detail

    - #### isEmpty

          boolean isEmpty()

      Returns `true` if this inbox contains no elements, `false` otherwise.

    - #### peek

          Object peek()

      Retrieves, but does not remove, the head of this inbox, or returns `null` if it is empty.

    - #### poll

          Object poll()

      Retrieves and removes the head of this inbox, or returns `null` if it is empty.

    - #### remove

          void remove()

      Removes the head of this inbox. This method throws an exception if the inbox is empty.
      Throws:
        `NoSuchElementException` - if this inbox is empty

    - #### drainTo

          default <E> int drainTo(Collection<E> target)

      Drains all elements into the provided `Collection`.
      Parameters:
        `target` - the collection to drain this object's items into
      Returns:
        the number of elements actually drained

    - #### drain

          default <E> int drain(Consumer<E> consumer)

      Passes each of this object's items to the supplied consumer until it is empty.
      Returns:
        the number of elements drained

    - #### size

          int size()

      Returns the number of objects in the inbox.

Copyright © 2019. All rights reserved.