T
- type of the list elementspublic class EvictingBoundedList<T> extends Object implements Iterable<T>, Serializable
The list by itself is serializable, but a full list can only be serialized if the values are also serializable.
Modifier and Type | Class and Description |
---|---|
static interface |
EvictingBoundedList.Function<I,O>
A simple unary function that can be used to transform elements via the
map(Function) method. |
Constructor and Description |
---|
EvictingBoundedList(EvictingBoundedList<T> other) |
EvictingBoundedList(int sizeLimit) |
EvictingBoundedList(int sizeLimit,
T defaultElement) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(T t) |
void |
clear() |
T |
get(int index) |
T |
getDefaultElement() |
int |
getSizeLimit() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
<R> EvictingBoundedList<R> |
map(EvictingBoundedList.Function<T,R> transform)
Creates a new list that replaces its elements with transformed elements.
|
T |
set(int index,
T element) |
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public EvictingBoundedList(int sizeLimit)
public EvictingBoundedList(EvictingBoundedList<T> other)
public EvictingBoundedList(int sizeLimit, T defaultElement)
public int size()
public boolean isEmpty()
public boolean add(T t)
public void clear()
public T get(int index)
public int getSizeLimit()
public T getDefaultElement()
public <R> EvictingBoundedList<R> map(EvictingBoundedList.Function<T,R> transform)
Note that null values are automatically mapped to null values.
R
- The type of the elements in the result list.transform
- The function used to transform each elementCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.