T - The type of the elements in the Bufferpublic final class ConcurrentBuffer<T> extends Object
| Constructor and Description |
|---|
ConcurrentBuffer()
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(T e)
Add single element to the buffer
|
void |
addAll(Collection<T> elements)
Add collection of elements to the buffer.
|
List<T> |
getAndRemove(int maxElementsToRemove)
Same as
getAndRemoveAll()
but only up to maxElementsToRemove elements will be returned.
|
List<T> |
getAndRemoveAll()
Get an remove all the current elements in the buffer.
|
public void add(T e)
e - An element to be added to the buffer.public void addAll(Collection<T> elements)
elements - A collection of elements to be added to the buffer.public List<T> getAndRemoveAll()
public List<T> getAndRemove(int maxElementsToRemove)
getAndRemoveAll()
but only up to maxElementsToRemove elements will be returned.
maxElementsToRemove - - The maximum number elements to be returned
from the buffer in the batch. If maxElementsToRemove = 0 returns an empty list.
IllegalArgumentException
- - If maxElementsToRemove is negative.
Copyright © 2016. All rights reserved.