/** * 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. */ public virtual int lastIndexOf(Object obj) { ListIterator <E> it = listIterator(size()); if (obj != null) { while (it.hasPrevious()) { if (obj.equals(it.previous())) { return(it.nextIndex()); } } } else { while (it.hasPrevious()) { if (it.previous() == null) { return(it.nextIndex()); } } } return(-1); }
public override bool addAll(int location, Collection <E> collection) { ListIterator <E> it = listIterator(location); Iterator <E> colIt = collection.iterator(); int next = it.nextIndex(); while (colIt.hasNext()) { it.add(colIt.next()); } return(next != it.nextIndex()); }
public bool hasNext() { return(iterator.nextIndex() < end); }
public int nextIndex() { return(iterator.nextIndex()); }