Class PSquarePercentile.FixedCapacityList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
org.apache.commons.math3.stat.descriptive.rank.PSquarePercentile.FixedCapacityList<E>
- Type Parameters:
E
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,List<E>
,RandomAccess
- Enclosing class:
PSquarePercentile
private static class PSquarePercentile.FixedCapacityList<E>
extends ArrayList<E>
implements Serializable
A simple fixed capacity list that has an upper bound to growth.
Once its capacity is reached,
add
is a no-op, returning
false
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
Capacity of the listprivate static final long
Serialization Version IdFields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionFixedCapacityList
(int fixedCapacity) This constructor constructs the list with given capacity and as well as stores the capacity -
Method Summary
Modifier and TypeMethodDescriptionboolean
In addition it checks if theArrayList.size()
returns a size that is within capacity and if true it adds; otherwise the list contents are unchanged andfalse
is returned.boolean
addAll
(Collection<? extends E> collection) In addition it checks if the sum of Collection size and this instance'sArrayList.size()
returns a value that is within capacity and if true it adds the collection; otherwise the list contents are unchanged andfalse
is returned.Methods inherited from class java.util.ArrayList
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
Methods inherited from class java.util.AbstractList
equals, hashCode
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream
Methods inherited from interface java.util.List
containsAll, equals, hashCode
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization Version Id- See Also:
-
capacity
private final int capacityCapacity of the list
-
-
Constructor Details
-
FixedCapacityList
FixedCapacityList(int fixedCapacity) This constructor constructs the list with given capacity and as well as stores the capacity- Parameters:
fixedCapacity
- the capacity to be fixed for this list
-
-
Method Details
-
add
In addition it checks if theArrayList.size()
returns a size that is within capacity and if true it adds; otherwise the list contents are unchanged andfalse
is returned. -
addAll
In addition it checks if the sum of Collection size and this instance'sArrayList.size()
returns a value that is within capacity and if true it adds the collection; otherwise the list contents are unchanged andfalse
is returned.
-