@SyntacticIterable public class Array<T> extends Iterable<T> implements Iterable<T>
Modifier and Type | Class and Description |
---|---|
static class |
Array.InitialValueT<T>
This class was automatically generated for disambiguating erased method
signatures.
|
static class |
Array.InitialValueU<U>
This class was automatically generated for disambiguating erased method
signatures.
|
static class |
Array.ItemsTs<T>
This class was automatically generated for disambiguating erased method
signatures.
|
static class |
Array.ItemsUs<U>
This class was automatically generated for disambiguating erased method
signatures.
|
Modifier and Type | Field and Description |
---|---|
int |
length
Gets or sets the length of the array.
|
static Array<?> |
prototype |
constructor
Constructor and Description |
---|
Array() |
Array(int arrayLength) |
Array(T... items) |
Modifier and Type | Method and Description |
---|---|
static Array<Object> |
$applyStatic() |
static Array<Object> |
$applyStatic(int arrayLength) |
static <T> T[] |
$applyStatic(T... items) |
T |
$get(int n) |
T |
$set(int n,
T value) |
Array<T> |
concat(Array.ItemsTs<T>... items)
Combines two or more arrays.
|
<U extends T> |
concat(Array.ItemsUs<U>... items)
Combines two or more arrays.
|
Array<T> |
concat(T... items)
Combines two or more arrays.
|
Array<T> |
copyWithin(int target,
int start)
Returns the this object after copying a section of the array identified by
start and end to the same array starting at position target
|
Array<T> |
copyWithin(int target,
int start,
int end)
Returns the this object after copying a section of the array identified by
start and end to the same array starting at position target
|
IterableIterator<Tuple2<Double,T>> |
entries()
Returns an array of key, value pairs for every entry in the array
|
Boolean |
every(Function<T,Boolean> callbackfn,
Object thisArg)
Determines whether all the members of an array satisfy the specified test.
|
Boolean |
every(TriFunction<T,Double,Array<T>,Boolean> callbackfn,
Object thisArg)
Determines whether all the members of an array satisfy the specified test.
|
Boolean |
every(TriFunction<T,Integer,Array<T>,Boolean> callbackfn)
Determines whether all the members of an array satisfy the specified test.
|
Array<T> |
fill(T value)
Returns the this object after filling the section identified by start and end
with value
|
Array<T> |
fill(T value,
int start)
Returns the this object after filling the section identified by start and end
with value
|
Array<T> |
fill(T value,
int start,
int end)
Returns the this object after filling the section identified by start and end
with value
|
Array<T> |
filter(Function<T,Boolean> callbackfn)
Returns the elements of an array that meet the condition specified in a
callback function.
|
Array<T> |
filter(Function<T,Boolean> callbackfn,
Object thisArg)
Returns the elements of an array that meet the condition specified in a
callback function.
|
Array<T> |
filter(TriFunction<T,Integer,Array<T>,Boolean> callbackfn)
Returns the elements of an array that meet the condition specified in a
callback function.
|
Array<T> |
filter(TriFunction<T,Integer,Array<T>,Boolean> callbackfn,
Object thisArg)
Returns the elements of an array that meet the condition specified in a
callback function.
|
T |
find(Function<T,Boolean> predicate,
Object thisArg)
Returns the value of the first element in the array where predicate is true,
and undefined otherwise.
|
T |
find(TriFunction<T,Integer,Array<T>,Boolean> predicate)
Returns the value of the first element in the array where predicate is true,
and undefined otherwise.
|
T |
find(TriFunction<T,Integer,Array<T>,Boolean> predicate,
Object thisArg)
Returns the value of the first element in the array where predicate is true,
and undefined otherwise.
|
int |
findIndex(Function<T,Boolean> predicate)
Returns the index of the first element in the array where predicate is true,
and undefined otherwise.
|
int |
findIndex(Function<T,Boolean> predicate,
Object thisArg)
Returns the index of the first element in the array where predicate is true,
and undefined otherwise.
|
void |
forEach(Consumer<T> callbackfn,
Object thisArg)
Performs the specified action for each element in an array.
|
void |
forEach(TriConsumer<T,Integer,Array<T>> callbackfn)
Performs the specified action for each element in an array.
|
void |
forEach(TriConsumer<T,Integer,Array<T>> callbackfn,
Object thisArg)
Performs the specified action for each element in an array.
|
static <T> Array<T> |
from(Object arrayLike) |
int |
indexOf(T searchElement)
Returns the index of the first occurrence of a value in an array.
|
int |
indexOf(T searchElement,
int fromIndex)
Returns the index of the first occurrence of a value in an array.
|
static Boolean |
isArray(Object arg) |
Iterator<T> |
iterator()
From Iterable, to allow foreach loop (do not use directly).
|
String |
join()
Adds all the elements of an array separated by the specified separator
string.
|
String |
join(String separator)
Adds all the elements of an array separated by the specified separator
string.
|
String |
join(String separator)
Adds all the elements of an array separated by the specified separator
string.
|
IterableIterator<Double> |
keys()
Returns an list of keys in the array
|
int |
lastIndexOf(T searchElement)
Returns the index of the last occurrence of a specified value in an array.
|
int |
lastIndexOf(T searchElement,
int fromIndex)
Returns the index of the last occurrence of a specified value in an array.
|
<U> Array<U> |
map(Function<T,U> callbackfn)
Calls a defined callback function on each element of an array, and returns an
array that contains the results.
|
<U> Array<U> |
map(Function<T,U> callbackfn,
Object thisArg)
Calls a defined callback function on each element of an array, and returns an
array that contains the results.
|
<U> Array<U> |
map(TriFunction<T,Integer,Array<T>,U> callbackfn)
Calls a defined callback function on each element of an array, and returns an
array that contains the results.
|
<U> Array<U> |
map(TriFunction<T,Integer,Array<T>,U> callbackfn,
Object thisArg)
Calls a defined callback function on each element of an array, and returns an
array that contains the results.
|
T |
pop()
Removes the last element from an array and returns it.
|
double |
push(T... items)
Appends new elements to an array, and returns the new length of the array.
|
T |
reduce(Function4<T,T,Integer,Array<T>,T> callbackfn)
Calls the specified callback function for all the elements in an array.
|
T |
reduceCallbackfnFunction4(Function4<T,T,Double,Array<T>,T> callbackfn,
Array.InitialValueT<T> initialValue)
Calls the specified callback function for all the elements in an array.
|
<U> U |
reduceCallbackfnUUFunction4(Function4<U,T,Double,Array<T>,U> callbackfn,
U initialValue)
Calls the specified callback function for all the elements in an array.
|
T |
reduceRight(Function4<T,T,Integer,Array<T>,T> callbackfn)
Calls the specified callback function for all the elements in an array, in
descending order.
|
T |
reduceRightCallbackfnFunction4(Function4<T,T,Double,Array<T>,T> callbackfn,
Array.InitialValueT<T> initialValue)
Calls the specified callback function for all the elements in an array, in
descending order.
|
<U> U |
reduceRightCallbackfnUUFunction4(Function4<U,T,Double,Array<T>,U> callbackfn,
U initialValue)
Calls the specified callback function for all the elements in an array, in
descending order.
|
Array<T> |
reverse()
Reverses the elements in an Array.
|
T |
shift()
Removes the first element from an array and returns it.
|
Array<T> |
slice()
Returns a section of an array.
|
Array<T> |
slice(int start)
Returns a section of an array.
|
Array<T> |
slice(int start,
int end)
Returns a section of an array.
|
Boolean |
some(Function<T,Boolean> callbackfn,
Object thisArg)
Determines whether the specified callback function returns true for any
element of an array.
|
Boolean |
some(TriFunction<T,Double,Array<T>,Boolean> callbackfn,
Object thisArg)
Determines whether the specified callback function returns true for any
element of an array.
|
Boolean |
some(TriFunction<T,Integer,Array<T>,Boolean> callbackfn)
Determines whether the specified callback function returns true for any
element of an array.
|
Array<T> |
sort()
Sorts an array.
|
Array<T> |
sort(BiFunction<T,T,Integer> compareFn)
Sorts an array.
|
Array<T> |
splice(int start)
Removes elements from an array and, if necessary, inserts new elements in
their place, returning the deleted elements.
|
Array<T> |
splice(int start,
int deleteCount,
T... items)
Removes elements from an array and, if necessary, inserts new elements in
their place, returning the deleted elements.
|
T[] |
toArray() |
int |
unshift(T... items)
Inserts new elements at the start of an array.
|
IterableIterator<T> |
values()
Returns an list of values in the array
|
$applyStatic, $delete, $delete, $get, $get, $set, $set, $super, assign, create, create, defineProperties, defineProperty, defineProperty, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, hasOwnProperty, hasOwnProperty, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, propertyIsEnumerable, propertyIsEnumerable, seal, toJSString, toLocaleString, toString, valueOf
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public int length
public static Array<?> prototype
public Array(int arrayLength)
public Array(T... items)
public Array()
public T[] toArray()
public double push(T... items)
items
- New elements of the Array.public T pop()
public Array<T> concat(T... items)
items
- Additional items to add to the end of array1.public <U extends T> Array<T> concat(Array.ItemsUs<U>... items)
items
- Additional items to add to the end of array1.public Array<T> concat(Array.ItemsTs<T>... items)
items
- Additional items to add to the end of array1.public String join(String separator)
separator
- A string used to separate one element of an array from the next in
the resulting String. If omitted, the array elements are separated
with a comma.public String join(String separator)
separator
- A string used to separate one element of an array from the next in
the resulting String. If omitted, the array elements are separated
with a comma.public T shift()
public Array<T> slice(int start, int end)
start
- The beginning of the specified portion of the array.end
- The end of the specified portion of the array.public Array<T> sort(BiFunction<T,T,Integer> compareFn)
compareFn
- The name of the function used to determine the order of the
elements. If omitted, the elements are sorted in ascending, ASCII
character order.public Array<T> splice(int start)
start
- The zero-based location in the array from which to start removing
elements.public Array<T> splice(int start, int deleteCount, T... items)
start
- The zero-based location in the array from which to start removing
elements.deleteCount
- The number of elements to remove.items
- Elements to insert into the array in place of the deleted
elements.public int unshift(T... items)
items
- Elements to insert at the start of the Array.public int indexOf(T searchElement, int fromIndex)
searchElement
- The value to locate in the array.fromIndex
- The array index at which to begin the search. If fromIndex is
omitted, the search starts at index 0.public int lastIndexOf(T searchElement, int fromIndex)
searchElement
- The value to locate in the array.fromIndex
- The array index at which to begin the search. If fromIndex is
omitted, the search starts at the last index in the array.public Boolean every(TriFunction<T,Double,Array<T>,Boolean> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. The every method
calls the callbackfn function for each element in array1 until the
callbackfn returns false, or until the end of the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public Boolean every(Function<T,Boolean> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. The every method
calls the callbackfn function for each element in array1 until the
callbackfn returns false, or until the end of the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public Boolean some(TriFunction<T,Double,Array<T>,Boolean> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. The some method
calls the callbackfn function for each element in array1 until the
callbackfn returns true, or until the end of the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public Boolean some(Function<T,Boolean> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. The some method
calls the callbackfn function for each element in array1 until the
callbackfn returns true, or until the end of the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public void forEach(TriConsumer<T,Integer,Array<T>> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. forEach calls the
callbackfn function one time for each element in the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public void forEach(Consumer<T> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. forEach calls the
callbackfn function one time for each element in the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public <U> Array<U> map(TriFunction<T,Integer,Array<T>,U> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. The map method
calls the callbackfn function one time for each element in the
array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public <U> Array<U> map(Function<T,U> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. The map method
calls the callbackfn function one time for each element in the
array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public Array<T> filter(TriFunction<T,Integer,Array<T>,Boolean> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. The filter method
calls the callbackfn function one time for each element in the
array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public Array<T> filter(Function<T,Boolean> callbackfn, Object thisArg)
callbackfn
- A function that accepts up to three arguments. The filter method
calls the callbackfn function one time for each element in the
array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.@Name(value="reduce") public T reduceCallbackfnFunction4(Function4<T,T,Double,Array<T>,T> callbackfn, Array.InitialValueT<T> initialValue)
callbackfn
- A function that accepts up to four arguments. The reduce method
calls the callbackfn function one time for each element in the
array.initialValue
- If initialValue is specified, it is used as the initial value to
start the accumulation. The first call to the callbackfn function
provides this value as an argument instead of an array value.@Name(value="reduce") public <U> U reduceCallbackfnUUFunction4(Function4<U,T,Double,Array<T>,U> callbackfn, U initialValue)
callbackfn
- A function that accepts up to four arguments. The reduce method
calls the callbackfn function one time for each element in the
array.initialValue
- If initialValue is specified, it is used as the initial value to
start the accumulation. The first call to the callbackfn function
provides this value as an argument instead of an array value.@Name(value="reduceRight") public T reduceRightCallbackfnFunction4(Function4<T,T,Double,Array<T>,T> callbackfn, Array.InitialValueT<T> initialValue)
callbackfn
- A function that accepts up to four arguments. The reduceRight
method calls the callbackfn function one time for each element in
the array.initialValue
- If initialValue is specified, it is used as the initial value to
start the accumulation. The first call to the callbackfn function
provides this value as an argument instead of an array value.@Name(value="reduceRight") public <U> U reduceRightCallbackfnUUFunction4(Function4<U,T,Double,Array<T>,U> callbackfn, U initialValue)
callbackfn
- A function that accepts up to four arguments. The reduceRight
method calls the callbackfn function one time for each element in
the array.initialValue
- If initialValue is specified, it is used as the initial value to
start the accumulation. The first call to the callbackfn function
provides this value as an argument instead of an array value.public T $get(int n)
public static <T> T[] $applyStatic(T... items)
public IterableIterator<Tuple2<Double,T>> entries()
public IterableIterator<Double> keys()
public IterableIterator<T> values()
public T find(TriFunction<T,Integer,Array<T>,Boolean> predicate, Object thisArg)
predicate
- find calls predicate once for each element of the array, in
ascending order, until it finds one where predicate returns true.
If such an element is found, find immediately returns that element
value. Otherwise, find returns undefined.thisArg
- If provided, it will be used as the this value for each invocation
of predicate. If it is not provided, undefined is used instead.public T find(Function<T,Boolean> predicate, Object thisArg)
predicate
- find calls predicate once for each element of the array, in
ascending order, until it finds one where predicate returns true.
If such an element is found, find immediately returns that element
value. Otherwise, find returns undefined.thisArg
- If provided, it will be used as the this value for each invocation
of predicate. If it is not provided, undefined is used instead.public int findIndex(Function<T,Boolean> predicate, Object thisArg)
predicate
- find calls predicate once for each element of the array, in
ascending order, until it finds one where predicate returns true.
If such an element is found, find immediately returns that element
value. Otherwise, find returns undefined.thisArg
- If provided, it will be used as the this value for each invocation
of predicate. If it is not provided, undefined is used instead.public Array<T> fill(T value, int start, int end)
value
- value to fill array section withstart
- index to start filling the array at. If start is negative, it is
treated as length+start where length is the length of the array.end
- index to stop filling the array at. If end is negative, it is
treated as length+end.public Array<T> copyWithin(int target, int start, int end)
target
- If target is negative, it is treated as length+target where length
is the length of the array.start
- If start is negative, it is treated as length+start. If end is
negative, it is treated as length+end.end
- If not specified, length of the this object is used as its default
value.public String join()
separator
- A string used to separate one element of an array from the next in
the resulting String. If omitted, the array elements are separated
with a comma.public Array<T> slice(int start)
start
- The beginning of the specified portion of the array.end
- The end of the specified portion of the array.public Array<T> slice()
start
- The beginning of the specified portion of the array.end
- The end of the specified portion of the array.public Array<T> sort()
compareFn
- The name of the function used to determine the order of the
elements. If omitted, the elements are sorted in ascending, ASCII
character order.public int indexOf(T searchElement)
searchElement
- The value to locate in the array.fromIndex
- The array index at which to begin the search. If fromIndex is
omitted, the search starts at index 0.public int lastIndexOf(T searchElement)
searchElement
- The value to locate in the array.fromIndex
- The array index at which to begin the search. If fromIndex is
omitted, the search starts at the last index in the array.public Boolean every(TriFunction<T,Integer,Array<T>,Boolean> callbackfn)
callbackfn
- A function that accepts up to three arguments. The every method
calls the callbackfn function for each element in array1 until the
callbackfn returns false, or until the end of the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public Boolean some(TriFunction<T,Integer,Array<T>,Boolean> callbackfn)
callbackfn
- A function that accepts up to three arguments. The some method
calls the callbackfn function for each element in array1 until the
callbackfn returns true, or until the end of the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public void forEach(TriConsumer<T,Integer,Array<T>> callbackfn)
callbackfn
- A function that accepts up to three arguments. forEach calls the
callbackfn function one time for each element in the array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public <U> Array<U> map(TriFunction<T,Integer,Array<T>,U> callbackfn)
callbackfn
- A function that accepts up to three arguments. The map method
calls the callbackfn function one time for each element in the
array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public <U> Array<U> map(Function<T,U> callbackfn)
callbackfn
- A function that accepts up to three arguments. The map method
calls the callbackfn function one time for each element in the
array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public Array<T> filter(TriFunction<T,Integer,Array<T>,Boolean> callbackfn)
callbackfn
- A function that accepts up to three arguments. The filter method
calls the callbackfn function one time for each element in the
array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public Array<T> filter(Function<T,Boolean> callbackfn)
callbackfn
- A function that accepts up to three arguments. The filter method
calls the callbackfn function one time for each element in the
array.thisArg
- An object to which the this keyword can refer in the callbackfn
function. If thisArg is omitted, undefined is used as the this
value.public T reduce(Function4<T,T,Integer,Array<T>,T> callbackfn)
callbackfn
- A function that accepts up to four arguments. The reduce method
calls the callbackfn function one time for each element in the
array.initialValue
- If initialValue is specified, it is used as the initial value to
start the accumulation. The first call to the callbackfn function
provides this value as an argument instead of an array value.public T reduceRight(Function4<T,T,Integer,Array<T>,T> callbackfn)
callbackfn
- A function that accepts up to four arguments. The reduceRight
method calls the callbackfn function one time for each element in
the array.initialValue
- If initialValue is specified, it is used as the initial value to
start the accumulation. The first call to the callbackfn function
provides this value as an argument instead of an array value.public T find(TriFunction<T,Integer,Array<T>,Boolean> predicate)
predicate
- find calls predicate once for each element of the array, in
ascending order, until it finds one where predicate returns true.
If such an element is found, find immediately returns that element
value. Otherwise, find returns undefined.thisArg
- If provided, it will be used as the this value for each invocation
of predicate. If it is not provided, undefined is used instead.public int findIndex(Function<T,Boolean> predicate)
predicate
- find calls predicate once for each element of the array, in
ascending order, until it finds one where predicate returns true.
If such an element is found, find immediately returns that element
value. Otherwise, find returns undefined.thisArg
- If provided, it will be used as the this value for each invocation
of predicate. If it is not provided, undefined is used instead.public Array<T> fill(T value, int start)
value
- value to fill array section withstart
- index to start filling the array at. If start is negative, it is
treated as length+start where length is the length of the array.end
- index to stop filling the array at. If end is negative, it is
treated as length+end.public Array<T> fill(T value)
value
- value to fill array section withstart
- index to start filling the array at. If start is negative, it is
treated as length+start where length is the length of the array.end
- index to stop filling the array at. If end is negative, it is
treated as length+end.public Array<T> copyWithin(int target, int start)
target
- If target is negative, it is treated as length+target where length
is the length of the array.start
- If start is negative, it is treated as length+start. If end is
negative, it is treated as length+end.end
- If not specified, length of the this object is used as its default
value.@Erased public Iterator<T> iterator()