)
Returns the last index in the list a
of the given element
, starting
the search at index startIndex
to 0.
Returns -1 if element
is not found.
Source
/**
* Returns the last index in the list [a] of the given [element], starting
* the search at index [startIndex] to 0.
* Returns -1 if [element] is not found.
*/
int lastIndexOf(Object element, [int startIndex]) {
if (startIndex == null) {
startIndex = this.length - 1;
} else {
if (startIndex < 0) {
return -1;
}
if (startIndex >= this.length) {
startIndex = this.length - 1;
}
}
for (int i = startIndex; i >= 0; i--) {
if (this[i] == element) {
return i;
}
}
return -1;
}