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

Method indexOf

lib/java/util/AbstractList.java:541–557  ·  view source on GitHub ↗

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

(Object object)

Source from the content-addressed store, hash-verified

539 * not found.
540 */
541 public int indexOf(Object object) {
542 ListIterator<?> it = listIterator();
543 if (object != null) {
544 while (it.hasNext()) {
545 if (object.equals(it.next())) {
546 return it.previousIndex();
547 }
548 }
549 } else {
550 while (it.hasNext()) {
551 if (it.next() == null) {
552 return it.previousIndex();
553 }
554 }
555 }
556 return -1;
557 }
558
559 /**
560 * Returns an iterator on the elements of this list. The elements are

Callers

nothing calls this directly

Calls 5

listIteratorMethod · 0.95
hasNextMethod · 0.65
equalsMethod · 0.65
nextMethod · 0.65
previousIndexMethod · 0.65

Tested by

no test coverage detected