
public final class JsArrayOf<T> extends JavaScriptObject implements ArrayOf<T>
ArrayOf.| Modifier | Constructor and Description |
|---|---|
protected |
JsArrayOf() |
| Modifier and Type | Method and Description |
|---|---|
JsArrayOf<T> |
concat(ArrayOf<T> values)
Returns a new array that is the concatenation of this array and
values. |
boolean |
contains(T value)
Indicates whether the array contains the specified value.
|
static <T> JsArrayOf<T> |
create()
Create a new empty Array instance.
|
T |
get(int index)
Gets the value at a given index.
|
int |
indexOf(T value)
Returns the index of the specified value or
-1 if the value is
not found. |
void |
insert(int index,
T value)
Inserts a new element into the array at the specified index.
|
boolean |
isEmpty()
Returns true if the length of the array is zero.
|
String |
join()
Convert each element of the array to a String and join them with a comma
separator.
|
String |
join(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.
|
T |
peek()
Returns the last value of the array;
|
T |
pop()
Remove and return the element from the end of the array.
|
void |
push(T value)
Pushes the given value onto the end of the array.
|
void |
remove(T value)
Searches for the specified value in the array and removes the first
occurrence if found.
|
void |
removeByIndex(int index)
Removes the element at the specified index.
|
void |
set(int index,
T value)
sets the value 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 |
sort(CanCompare<T> comparator)
Sorts the contents of the Array based on the
CanCompare. |
JsArrayOf<T> |
splice(int index,
int count)
Removes the specified number of elements starting at index and returns the
removed elements.
|
void |
unshift(T value)
Shifts a value onto the beginning of the array.
|
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toStringpublic static <T> JsArrayOf<T> create()
public JsArrayOf<T> concat(ArrayOf<T> values)
ArrayOf
values. This method does not mutate the current array.public boolean contains(T value)
ArrayOfpublic T get(int index)
ArrayOfpublic int indexOf(T value)
ArrayOf-1 if the value is
not found.public void insert(int index,
T value)
ArrayOfpublic boolean isEmpty()
ArrayOfpublic String join()
public String join(String separator)
ArrayOfpublic int length()
ArrayOfpublic T peek()
ArrayOfpublic T pop()
ArrayOfpublic void push(T value)
public void remove(T value)
ArrayOfpublic void removeByIndex(int index)
ArrayOfremoveByIndex in interface ArrayOf<T>public void set(int index,
T value)
ArrayOfpublic void setLength(int newLength)
ArrayOfpublic T shift()
ArrayOfpublic void sort(CanCompare<T> comparator)
ArrayOfCanCompare.public JsArrayOf<T> splice(int index, int count)
ArrayOfCopyright © 2016. All rights reserved.