T
- the concrete type of object contained in this arraypublic class JsArray<T extends JavaScriptObject> extends JavaScriptObject
JavaScriptObject
values.
This class may not be directly instantiated, and can only be returned from a
native method. For example,
native JsArray getNativeArray() /*-{
return [
{ x: 0, y: 1},
{ x: 2, y: 3},
{ x: 4, y: 5},
];
}-* /;
Modifier | Constructor and Description |
---|---|
protected |
JsArray() |
Modifier and Type | Method and Description |
---|---|
T |
get(int index)
Gets the object at a given index.
|
java.lang.String |
join()
Convert each element of the array to a String and join them with a comma
separator.
|
java.lang.String |
join(java.lang.String separator)
Convert each element of the array to a String and join them with a comma
separator.
|
int |
length()
Gets the length of the array.
|
void |
push(T value)
Pushes the given value onto the end of the array.
|
void |
set(int index,
T value)
Sets the object value at a given index.
|
void |
setLength(int newLength)
Reset the length of the array.
|
T |
shift()
Shifts the first value off the array.
|
void |
unshift(T value)
Shifts a value onto the beginning of the array.
|
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
public final T get(int index)
index
- the index to be retrievednull
if none existspublic final java.lang.String join()
public final java.lang.String join(java.lang.String separator)
public final int length()
public final void push(T value)
public final void set(int index, T value)
index
- the index to be setvalue
- the object to be storedpublic final void setLength(int newLength)
newLength
- the new length of the arraypublic final T shift()
public final void unshift(T value)
value
- the value to the stored