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