lastIndexOf method

int lastIndexOf(
  1. T element
)

Returns last index of element, or -1 if the collection does not contain element.

Implementation

int lastIndexOf(T element) {
  if (this is KtList) return (this as KtList).lastIndexOf(element);
  var lastIndex = -1;
  var index = 0;
  for (final item in iter) {
    if (element == item) {
      lastIndex = index;
    }
    index++;
  }
  return lastIndex;
}