Class calitha.collections.IList
Extends
calitha.collections.ICollection.
An ordered collection (also known as a sequence).
It is based on the Java List interface. Differences are:
- The Java remove method using an int index has been changed to calitha.collections.IList#del
- The Java add method using an int index has been changed to calitha.collections.IList#insert
- The Java addAll method using an int index has been changed to calitha.collections.IList#insertAll
Defined in: IList.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
del(index)
Removes the element at the specified position in this list.
|
|
get(index)
Returns the element at the specified position in this list.
|
|
indexOf(element)
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
|
|
insert(index, element)
Inserts the specified element at the specified position in this list.
|
|
insertAll(index, collection)
Inserts all of the elements in the specified collection into this list at the specified position.
|
|
lastIndexOf(element)
Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
|
|
listIterator(index)
Returns a list iterator over the elements in this list (in proper sequence).
|
|
set(index, element)
Replaces the element at the specified position in this list with the specified element.
|
|
sort(comparator)
Sorts the specified list based on the comparator or IComparable elements if there is no comparator
|
|
subList(fromIndex, toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
|
- Methods borrowed from class calitha.collections.ICollection:
- add, addAll, clear, contains, containsAll, equals, forEach, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray
Method Detail
{Boolean}
del(index)
Removes the element at the specified position in this list.
- Parameters:
- {Number} index
- the index of the element to be removed
- Returns:
- {Boolean} the element previously at the specified position
{Object}
get(index)
Returns the element at the specified position in this list.
- Parameters:
- {Number} index
- index of the element to return
- Returns:
- {Object} the element at the specified position in this list
{Number}
indexOf(element)
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
- Parameters:
- {Object} element
- element to search for
- Returns:
- {Number} the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
insert(index, element)
Inserts the specified element at the specified position in this list.
- Parameters:
- {Number} index
- index at which the specified element is to be inserted
- {Object} element
- element to be inserted
{Boolean}
insertAll(index, collection)
Inserts all of the elements in the specified collection into this list at the specified position.
- Parameters:
- {Number} index
- index at which to insert the first element from the specified collection
- {calitha.collections.ICollection} collection
- collection containing elements to be added to this list
- Returns:
- {Boolean} true if this list changed as a result of the call
{Number}
lastIndexOf(element)
Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
- Parameters:
- {Object} element
- element to search for
- Returns:
- {Number} the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element
{calitha.collections.IListIterator}
listIterator(index)
Returns a list iterator over the elements in this list (in proper sequence).
- Parameters:
- {Number?} index
- optional index of first element to be returned from the list iterator. Default value is 0.
- Returns:
- {calitha.collections.IListIterator} a list iterator over the elements in this list (in proper sequence)
{Object}
set(index, element)
Replaces the element at the specified position in this list with the specified element.
- Parameters:
- {Number} index
- index of the element to replace
- {Object} element
- element to be stored at the specified position
- Returns:
- {Object} the element previously at the specified position
sort(comparator)
Sorts the specified list based on the comparator or IComparable elements if there is no comparator
- Parameters:
- {(calitha.collections.IComparator|Function)?} comparator
- optional comparator that is a IComparator or a function
{calitha.collections.IList}
subList(fromIndex, toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
- Parameters:
- {Number} fromIndex
- low endpoint (inclusive) of the subList
- {Number} toIndex
- Returns:
- {calitha.collections.IList} a view of the specified range within this list