Repository URL to install this package:
Version:
1.2.7 ▾
|
/**
* @todo extends Array
* @todo could `setPrototype` for `instanceof`?
*/
declare class ArrayList<Value> {
array: Array<Value>;
constructor(array?: ArrayList<Value> | Array<Value>);
/**
* ArrayList.get() Returns the element at the specified position in this list.
* @param i index of element to return
* @returns the element at the specified position in this list.
*/
get(index: number): Value;
indexOf(item: Value): number;
/**
* ArrayList.lastIndexOf() Returns the index of the last occurrence of the specified element in this list,
* or -1 if this list does not contain the element. More formally, returns the highest index i such that
* (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
*
* @param item element to search for.
* @returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
*/
lastIndexOf(item: Value): number;
/**
* ArrayList.clear() Removes all of the elements from this list.
* The list will be empty after this call returns.
*/
clear(): void;
/**
* ArrayList.isEmpty() Tests if this list has no elements.
* @returns true if this list has no elements; false otherwise
*/
isEmpty(): boolean;
/**
* ArrayList.clone() Returns a shallow copy of this ArrayList instance. (The elements themselves are not copied.)
* @returns a clone of this ArrayList instance
*/
clone(): any;
/**
* ArrayList.toArray() Returns an array containing all of the elements in this list in the correct order.
* @returns Returns an array containing all of the elements in this list in the correct order
*/
toArray(): Value[];
/**
* @name toIterator
* @name entries
*/
iterator(): Iterator<Value> | IterableIterator<[string, Value]>;
/**
* @alias length
* ArrayList.size() Returns the number of elements in this list.
* @returns the number of elements in this list
*/
readonly size: number;
readonly length: number;
/**
* ArrayList.remove() Removes an element either based on index, if the argument is a number, or
* by equality check, if the argument is an object.
*
* @param item either the index of the element to be removed, or the element itself.
* @returns If removal is by index, the element that was removed, or null if nothing was removed. If removal is by object, true if removal occurred, otherwise false.
*/
remove(item: Value): boolean | Value;
/**
* ArrayList.set() Replaces the element at the specified position in this list with the specified element.
*
* @param index index of element to replace
* @param object element to be stored at the specified position
*/
set(index: number | Value, value?: Value): void;
/**
* ArrayList.add() Adds the specified element to this list.
* @param index optional index at which the specified element is to be inserted
* @param object element to be added to the list
*/
add(index: number | Value, value?: Value): void;
/**
* @memberof ArrayList
* ArrayList.addAll(collection) appends all of the elements in the specified
* Collection to the end of this list, in the order that they are returned by
* the specified Collection's Iterator.
*
* When called as addAll(index, collection) the elements are inserted into
* this list at the position indicated by index.
*
* @param {index} Optional; specifies the position the colletion should be inserted at
* @param {collection} Any iterable object (ArrayList, HashMap.keySet(), etc.)
* @throws out of bounds error for negative index, or index greater than list size.
*/
addAll(arg1: number | any, arg2?: any): void;
includes(x: any): boolean;
/**
* ArrayList.removeAll Removes from this List all of the elements from
* the current ArrayList which are present in the passed in paramater ArrayList 'c'.
* Shifts any succeeding elements to the left (reduces their index).
*
* @param the ArrayList to compare to the current ArrayList
*
* @returns true if the ArrayList had an element removed; false otherwise
*/
removeAll(arrayList: ArrayList<Value>): boolean;
}
export { ArrayList };
export default ArrayList;