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