public class PrimitiveIntArray extends AbstractPrimitiveArray
Constructor and Description |
---|
PrimitiveIntArray()
Default constructor
|
PrimitiveIntArray(PrimitiveIntArray sourceArray)
Copying constructor
|
Modifier and Type | Method and Description |
---|---|
int[] |
asArray()
Get a reference to a int[] that represents the contents of this array.
|
static <A extends PrimitiveIntArray> |
copyInstance(A source)
Create a new <A extends
PrimitiveIntArray > instance, using a copy constructor to
replicate the contents of the given source array |
static <A extends PrimitiveIntArray> |
copyInstance(java.lang.invoke.MethodHandles.Lookup lookup,
A source)
Create a new <A extends
PrimitiveIntArray > instance, using a copy constructor to
replicate the contents of the given source array |
int |
get(int index)
Get the value of an element in the array.
|
int |
get(long index)
Get the value of an element in the array.
|
long |
getLength()
Get the length of the array
|
static <A extends PrimitiveIntArray> |
newInstance(java.lang.Class<A> arrayClass,
long length)
Create a new instance of <A extends
PrimitiveIntArray > with a given length. |
static <A extends PrimitiveIntArray> |
newInstance(CtorAndArgs<A> arrayCtorAndArgs,
long length)
Create a new instance of <A extends
PrimitiveIntArray > with a given length,
array constructor, and array constructor arguments. |
static PrimitiveIntArray |
newInstance(long length)
Create a new instance of
PrimitiveIntArray with a given length. |
static <A extends PrimitiveIntArray> |
newInstance(long length,
java.lang.reflect.Constructor<A> arrayConstructor,
java.lang.Object... arrayConstructorArgs)
Create a new instance of <A extends
PrimitiveIntArray > with a given length,
array constructor, and array constructor arguments. |
static <A extends PrimitiveIntArray> |
newInstance(java.lang.invoke.MethodHandles.Lookup lookup,
java.lang.Class<A> arrayClass,
long length)
Create a new instance of <A extends
PrimitiveIntArray > with a given length. |
void |
set(int index,
int value)
set the value of an element in the array.
|
void |
set(long index,
int value)
set the value of an element in the array.
|
public PrimitiveIntArray()
public PrimitiveIntArray(PrimitiveIntArray sourceArray)
sourceArray
- the array to copypublic int[] asArray() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if array is too long to represent as a int[]public long getLength()
public int get(int index)
index
- the index of the elementpublic int get(long index)
index
- the index of the elementpublic void set(int index, int value)
index
- the index of the element to setvalue
- the value to assign to the elementpublic void set(long index, int value)
index
- the index of the element to setvalue
- the value to assign to the elementpublic static PrimitiveIntArray newInstance(long length)
PrimitiveIntArray
with a given length.length
- the length of the array.PrimitiveIntArray
with the given lengthpublic static <A extends PrimitiveIntArray> A newInstance(java.lang.Class<A> arrayClass, long length)
PrimitiveIntArray
> with a given length.A
- The class of the array to be created (extends PrimitiveIntArray)arrayClass
- The class of the array to be created (extends PrimitiveIntArray)length
- the length of the array.PrimitiveIntArray
> with a given lengthpublic static <A extends PrimitiveIntArray> A newInstance(java.lang.invoke.MethodHandles.Lookup lookup, java.lang.Class<A> arrayClass, long length)
PrimitiveIntArray
> with a given length.A
- The class of the array to be created (extends PrimitiveIntArray)lookup
- The lookup object to use for accessing the array's constructorarrayClass
- The class of the array to be created (extends PrimitiveIntArray)length
- the length of the array.PrimitiveIntArray
> with a given lengthpublic static <A extends PrimitiveIntArray> A newInstance(CtorAndArgs<A> arrayCtorAndArgs, long length)
PrimitiveIntArray
> with a given length,
array constructor, and array constructor arguments.A
- The class of the array to be created (extends PrimitiveIntArray)length
- The length of the array.arrayCtorAndArgs
- for creating the arrayPrimitiveIntArray
>public static <A extends PrimitiveIntArray> A newInstance(long length, java.lang.reflect.Constructor<A> arrayConstructor, java.lang.Object... arrayConstructorArgs)
PrimitiveIntArray
> with a given length,
array constructor, and array constructor arguments.A
- The class of the array to be created (extends PrimitiveIntArray)length
- The length of the array.arrayConstructor
- The array constructor to usearrayConstructorArgs
- The arguments to pass to the array constructorPrimitiveIntArray
>public static <A extends PrimitiveIntArray> A copyInstance(A source) throws java.lang.NoSuchMethodException
PrimitiveIntArray
> instance, using a copy constructor to
replicate the contents of the given source arrayA
- The class of the array to be created (extends PrimitiveIntArray)source
- The array to replicatePrimitiveIntArray
> copied from the source arrayjava.lang.NoSuchMethodException
- if <A> does not have a copy constructorpublic static <A extends PrimitiveIntArray> A copyInstance(java.lang.invoke.MethodHandles.Lookup lookup, A source) throws java.lang.NoSuchMethodException
PrimitiveIntArray
> instance, using a copy constructor to
replicate the contents of the given source arrayA
- The class of the array to be created (extends PrimitiveIntArray)lookup
- The lookup object to use for accessing the array's constructorsource
- The array to replicatePrimitiveIntArray
> copied from the source arrayjava.lang.NoSuchMethodException
- if <A> does not have a copy constructor