Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all items from the inbox.
|
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 . |
default <E> int |
drainTo(Collection<E> target,
int limit)
Drains at most
limit elements into the provided Collection . |
default <E,M> int |
drainTo(Collection<M> target,
int limit,
Function<E,M> mapper)
Drains and maps at most
limit elements into the provided
Collection . |
boolean |
isEmpty()
Returns
true if this inbox contains no elements, false otherwise. |
Iterator<Object> |
iterator()
Returns an iterator over the items in the inbox in the order they would
be returned by the
poll() method. |
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.
|
forEach, spliterator
boolean isEmpty()
true
if this inbox contains no elements, false
otherwise.@Nullable Object peek()
null
if it is empty.@Nullable Object poll()
null
if it is empty.void remove()
NoSuchElementException
- if this inbox is empty@Nonnull Iterator<Object> iterator()
poll()
method.
The returned iterator doesn't support the Iterator.remove()
method.
void clear()
default <E> int drainTo(Collection<E> target)
Collection
.target
- the collection to drain this object's items intodefault <E> int drainTo(@Nonnull Collection<E> target, int limit)
limit
elements into the provided Collection
.target
- the collection to drain this object's items intolimit
- the maximum amount of items to draindefault <E,M> int drainTo(@Nonnull Collection<M> target, int limit, @Nonnull Function<E,M> mapper)
limit
elements into the provided
Collection
.target
- the collection to drain this object's items intolimit
- the maximum amount of items to drainmapper
- mapping function to apply to this object's itemsdefault <E> int drain(@Nonnull Consumer<E> consumer)
int size()
Copyright © 2021 Hazelcast, Inc.. All rights reserved.