MCPcopy Create free account
hub / github.com/davidgiven/luje / lastIndexOf

Method lastIndexOf

lib/java/util/AbstractList.java:580–596  ·  view source on GitHub ↗

Searches this list for the specified object and returns the index of the last occurrence. @param object the object to search for. @return the index of the last occurrence of the object, or -1 if the object was not found.

(Object object)

Source from the content-addressed store, hash-verified

578 * object was not found.
579 */
580 public int lastIndexOf(Object object) {
581 ListIterator<?> it = listIterator(size());
582 if (object != null) {
583 while (it.hasPrevious()) {
584 if (object.equals(it.previous())) {
585 return it.nextIndex();
586 }
587 }
588 } else {
589 while (it.hasPrevious()) {
590 if (it.previous() == null) {
591 return it.nextIndex();
592 }
593 }
594 }
595 return -1;
596 }
597
598 /**
599 * Returns a ListIterator on the elements of this list. The elements are

Callers

nothing calls this directly

Calls 6

listIteratorMethod · 0.95
sizeMethod · 0.65
hasPreviousMethod · 0.65
equalsMethod · 0.65
previousMethod · 0.65
nextIndexMethod · 0.65

Tested by

no test coverage detected