public class ShortArrayView extends Object implements Cloneable
Constructor and Description |
---|
ShortArrayView(int n)
Create a view on an array of length n.
|
ShortArrayView(short[] array)
Create a view on the entirety of the given array.
|
ShortArrayView(short[] array,
int l,
int r)
Create a view on the given array from l (inclusive) to
r (exclusive).
|
Modifier and Type | Method and Description |
---|---|
ShortArrayView |
clone() |
short |
get(int i)
Get the ith element of this array view.
|
short |
getFast(int i)
Get the ith element of this array view omitting any
bounds checks.
|
short[] |
getUnderlyingStorage()
Get access to the underlying array of this view.
|
void |
set(int i,
short v)
Set the ith element of this array view to the value v.
|
void |
setFast(int i,
short v)
Set the ith element of this array view to the value v.
|
int |
size()
Get the size (number of elements) in the view.
|
ShortArrayView |
subView(int l1,
int r1)
Get a subview of this view from l1 (inclusive) to r1 (exclusive).
|
short[] |
toArray()
Convert this view to an array.
|
String |
toString() |
public ShortArrayView(short[] array, int l, int r)
array
- the arrayl
- start (left) indexr
- end (right) indexpublic ShortArrayView(short[] array)
array
- the array.public ShortArrayView(int n)
n
- the length of the view and underlying array.public ShortArrayView subView(int l1, int r1)
l1
- start (left) indexr1
- end (right) indexpublic short get(int i)
i
- the index to getpublic short getFast(int i)
i
- the index to getpublic void set(int i, short v)
i
- the index to setv
- the value to setpublic void setFast(int i, short v)
i
- the index to setv
- the value to setpublic short[] getUnderlyingStorage()
public int size()
public short[] toArray()
public ShortArrayView clone()