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 intCapacity of the listprivate static final longSerialization Version IdFields inherited from class 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 TypeMethodDescriptionbooleanIn addition it checks if theArrayList.size()returns a size that is within capacity and if true it adds; otherwise the list contents are unchanged andfalseis returned.booleanaddAll(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 andfalseis returned.Methods inherited from class 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, trimToSizeMethods inherited from class AbstractList
equals, hashCodeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, streamMethods inherited from interface 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 andfalseis 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 andfalseis returned.
-