public class Array<T> extends Objs implements Iterable<T>
Objs.Constructor<T extends Objs>, Objs.Property<T>
Modifier and Type | Field and Description |
---|---|
Objs.Property<Number> |
length
Gets or sets the length of the array.
|
static Array<Object> |
prototype |
Modifier | Constructor and Description |
---|---|
|
Array() |
|
Array(double arrayLength) |
protected |
Array(Objs.Constructor<?> constructor,
Object js) |
|
Array(T... items) |
Modifier and Type | Method and Description |
---|---|
static Array<?> |
$as(Object obj)
Casts given object to this class.
|
T |
$get(double index)
Gets an item from the array.
|
Array<T> |
$set(double index,
Object value)
Sets a value at index in the array.
|
Array<T> |
concat(T... items)
Combines two or more arrays.
|
Boolean |
every(Function.A3<? super T,? super Number,? super Array<T>,? extends Boolean> callbackfn)
Determines whether all the members of an array satisfy the specified test.
|
Boolean |
every(Function.A3<? super T,? super Number,? super Array<T>,? extends Boolean> callbackfn,
Object thisArg)
Determines whether all the members of an array satisfy the specified test.
|
Array<T> |
filter(Function.A3<? super T,? super Number,? super Array<T>,? extends Boolean> callbackfn)
Returns the elements of an array that meet the condition specified in a callback function.
|
Array<T> |
filter(Function.A3<? super T,? super Number,? super Array<T>,? extends Boolean> callbackfn,
Object thisArg)
Returns the elements of an array that meet the condition specified in a callback function.
|
void |
forEach(Function.A3<? super T,? super Number,? super Array<T>,? extends Void> callbackfn)
Performs the specified action for each element in an array.
|
void |
forEach(Function.A3<? super T,? super Number,? super Array<T>,? extends Void> callbackfn,
Object thisArg)
Performs the specified action for each element in an array.
|
double |
indexOf(T searchElement)
Returns the index of the first occurrence of a value in an array.
|
double |
indexOf(T searchElement,
double fromIndex)
Returns the index of the first occurrence of a value in an array.
|
static Boolean |
isArray(Object arg) |
Iterator<T> |
iterator() |
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.
|
double |
lastIndexOf(T searchElement)
Returns the index of the last occurrence of a specified value in an array.
|
double |
lastIndexOf(T searchElement,
double fromIndex)
Returns the index of the last occurrence of a specified value in an array.
|
int |
length()
Returns length of the array.
|
<U> Array<U> |
map(Function.A3<? super T,? super Number,? super Array<T>,? extends 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.A3<? super T,? super Number,? super Array<T>,? extends U> callbackfn,
Object thisArg)
Calls a defined callback function on each element of an array, and returns an array that contains the results.
|
static <T> Array<T> |
newArray() |
static <T> Array<T> |
newArray(double arrayLength) |
static <T> Array<T> |
newArray(T... items) |
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.
|
<U> U |
reduce(Function.A4<? super U,? super T,? super Number,? super Array<T>,? extends U> callbackfn)
Calls the specified callback function for all the elements in an array.
|
<U> U |
reduce(Function.A4<? super U,? super T,? super Number,? super Array<T>,? extends U> callbackfn,
U initialValue)
Calls the specified callback function for all the elements in an array.
|
<U> U |
reduceRight(Function.A4<? super U,? super T,? super Number,? super Array<T>,? extends U> callbackfn)
Calls the specified callback function for all the elements in an array, in descending order.
|
<U> U |
reduceRight(Function.A4<? super U,? super T,? super Number,? super Array<T>,? extends 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(double start)
Returns a section of an array.
|
Array<T> |
slice(double start,
double end)
Returns a section of an array.
|
Boolean |
some(Function.A3<? super T,? super Number,? super Array<T>,? extends Boolean> callbackfn)
Determines whether the specified callback function returns true for any element of an array.
|
Boolean |
some(Function.A3<? super T,? super Number,? super Array<T>,? extends Boolean> callbackfn,
Object thisArg)
Determines whether the specified callback function returns true for any element of an array.
|
Array<T> |
sort()
Sorts an array.
|
Array<T> |
sort(Function.A2<? super T,? super T,? extends Number> compareFn)
Sorts an array.
|
Array<T> |
splice(double start)
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
|
Array<T> |
splice(double start,
double deleteCount,
T... items)
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
|
Object[] |
toArray()
Converts the JavaScript array into Java array.
|
String |
toLocaleString()
Returns a date converted to a string using the current locale.
|
String |
toString()
Returns a string representation of an array.
|
double |
unshift(T... items)
Inserts new elements at the start of an array.
|
$as, $cast, $delete, $get, $js, $set, create, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPrototypeOf, hasOwnProperty, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, newObject, newObject, preventExtensions, propertyIsEnumerable, seal, valueOf
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Objs.Property<Number> length
protected Array(Objs.Constructor<?> constructor, Object js)
public Array(double arrayLength)
public Array()
public Array(T... items)
public static Array<?> $as(Object obj)
obj
- any objectobj
objectpublic int length()
length
property converted to integerpublic T $get(double index)
index
- the (integer) index to the arraypublic Array<T> $set(double index, Object value)
index
- the (integer) index into the arrayvalue
- value to assign at that indexthis
arraypublic Array<T> concat(T... items)
items
- Additional items to add to the end of array1.public Boolean every(Function.A3<? super T,? super Number,? super Array<T>,? extends 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.A3<? super T,? super Number,? super Array<T>,? extends 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 Array<T> filter(Function.A3<? super T,? super Number,? super Array<T>,? extends 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.A3<? super T,? super Number,? super Array<T>,? extends 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 void forEach(Function.A3<? super T,? super Number,? super Array<T>,? extends Void> 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(Function.A3<? super T,? super Number,? super Array<T>,? extends Void> 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 double indexOf(T searchElement, double 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 double 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 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()
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 double lastIndexOf(T searchElement, double 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 double 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 <U> Array<U> map(Function.A3<? super T,? super Number,? super Array<T>,? extends 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.A3<? super T,? super Number,? super Array<T>,? extends 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 T pop()
public double push(T... items)
items
- New elements of the Array.public <U> U reduce(Function.A4<? super U,? super T,? super Number,? super Array<T>,? extends 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.public <U> U reduce(Function.A4<? super U,? super T,? super Number,? super Array<T>,? extends U> 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 <U> U reduceRight(Function.A4<? super U,? super T,? super Number,? super Array<T>,? extends 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 <U> U reduceRight(Function.A4<? super U,? super T,? super Number,? super Array<T>,? extends U> 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 shift()
public Array<T> slice(double start, double end)
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> slice(double start)
start
- The beginning of the specified portion of the array.end
- The end of the specified portion of the array.public Boolean some(Function.A3<? super T,? super Number,? super Array<T>,? extends 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.A3<? super T,? super Number,? super Array<T>,? extends 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 Array<T> sort(Function.A2<? super T,? super T,? extends Number> 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> 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 Array<T> splice(double start)
start
- The zero-based location in the array from which to start removing elements.public Array<T> splice(double start, double 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 String toLocaleString()
Objs
toLocaleString
in class Objs
public double unshift(T... items)
items
- Elements to insert at the start of the Array.public static <T> Array<T> newArray(double arrayLength)
public static <T> Array<T> newArray()
public static <T> Array<T> newArray(T... items)
public String toString()
public Object[] toArray()
Copyright © 2018. All rights reserved.