E
- private static class PSquarePercentile.FixedCapacityList<E>
extends java.util.ArrayList<E>
implements java.io.Serializable
add
is a no-op, returning
false
.Modifier and Type | Field and Description |
---|---|
private int |
capacity
Capacity of the list
|
private static long |
serialVersionUID
Serialization Version Id
|
Constructor and Description |
---|
FixedCapacityList(int fixedCapacity)
This constructor constructs the list with given capacity and as well
as stores the capacity
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e)
In addition it checks if the
ArrayList.size() returns a
size that is within capacity and if true it adds; otherwise the list
contents are unchanged and false is returned. |
boolean |
addAll(java.util.Collection<? extends E> collection)
In addition it checks if the sum of Collection size and
this instance's
ArrayList.size() returns a value that is within
capacity and if true it adds the collection; otherwise the list
contents are unchanged and false is returned. |
add, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
private static final long serialVersionUID
private final int capacity
public FixedCapacityList(int fixedCapacity)
fixedCapacity
- the capacity to be fixed for this listpublic boolean add(E e)
ArrayList.size()
returns a
size that is within capacity and if true it adds; otherwise the list
contents are unchanged and false
is returned.public boolean addAll(java.util.Collection<? extends E> collection)
ArrayList.size()
returns a value that is within
capacity and if true it adds the collection; otherwise the list
contents are unchanged and false
is returned.