E
- the primitive wrapper class to usepublic abstract class PackedPrimitiveWrapperArrayList<E extends Number> extends AbstractList<E>
PackedIntegerArrayList
using the List
interface where the element type can be any primitive wrapper class of the Java API, namely Byte
,
Short
, Integer
or Long
. The number of bits per value to be stored in the underlying
packed list can be determined independently of the selected wrapper type.Modifier and Type | Field and Description |
---|---|
protected PackedIntegerArrayList |
packedList |
modCount
Modifier | Constructor and Description |
---|---|
protected |
PackedPrimitiveWrapperArrayList(int bitsPerValue,
long minValue,
int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
E element) |
static PackedPrimitiveWrapperArrayList<Byte> |
newByteInstance(int bitsPerValue,
long minValue,
int initialCapacity)
Creates a new instance of this class using
Byte elements. |
static PackedPrimitiveWrapperArrayList<Integer> |
newIntegerInstance(int bitsPerValue,
long minValue,
int initialCapacity)
Creates a new instance of this class using
Integer elements. |
static PackedPrimitiveWrapperArrayList<Long> |
newLongInstance(int bitsPerValue,
long minValue,
int initialCapacity)
Creates a new instance of this class using
Long elements. |
static PackedPrimitiveWrapperArrayList<Short> |
newShortInstance(int bitsPerValue,
long minValue,
int initialCapacity)
Creates a new instance of this class using
Short elements. |
E |
remove(int index) |
protected void |
removeRange(int fromIndex,
int toIndex) |
E |
set(int index,
E element) |
int |
size() |
add, addAll, clear, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
protected PackedIntegerArrayList packedList
protected PackedPrimitiveWrapperArrayList(int bitsPerValue, long minValue, int initialCapacity)
public static PackedPrimitiveWrapperArrayList<Byte> newByteInstance(int bitsPerValue, long minValue, int initialCapacity)
Byte
elements.bitsPerValue
- the number of bits per value that shall be storedminValue
- the minimal value to be represented by the underlying packed listinitialCapacity
- the initial number of elements the underlying packed list can take up before
resizing its arrayIllegalArgumentException
- if the combination if bits per value and the minimal value could lead to
values that cannot be stored in a byte
public static PackedPrimitiveWrapperArrayList<Short> newShortInstance(int bitsPerValue, long minValue, int initialCapacity)
Short
elements.bitsPerValue
- the number of bits per value that shall be storedminValue
- the minimal value to be represented by the underlying packed listinitialCapacity
- the initial number of elements the underlying packed list can take up before
resizing its arrayIllegalArgumentException
- if the combination if bits per value and the minimal value could lead to
values that cannot be stored in a short
public static PackedPrimitiveWrapperArrayList<Integer> newIntegerInstance(int bitsPerValue, long minValue, int initialCapacity)
Integer
elements.bitsPerValue
- the number of bits per value that shall be storedminValue
- the minimal value to be represented by the underlying packed listinitialCapacity
- the initial number of elements the underlying packed list can take up before
resizing its arrayIllegalArgumentException
- if the combination if bits per value and the minimal value could lead to
values that cannot be stored in a int
public static PackedPrimitiveWrapperArrayList<Long> newLongInstance(int bitsPerValue, long minValue, int initialCapacity)
Long
elements.bitsPerValue
- the number of bits per value that shall be storedminValue
- the minimal value to be represented by the underlying packed listinitialCapacity
- the initial number of elements the underlying packed list can take up before
resizing its arrayIllegalArgumentException
- if the combination if bits per value and the minimal value could lead to
values that cannot be stored in a long
protected void removeRange(int fromIndex, int toIndex)
removeRange
in class AbstractList<E extends Number>