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