public Object next() { checkModCount(); if (!hasNext()) { throw new NoSuchElementException("No element at index " + nextIndex + "."); } if (next == null) { next = parent.root.get(nextIndex); } Object value = next.getValue(); current = next; currentIndex = nextIndex++; next = next.next(); return value; }
public Object previous() { checkModCount(); if (!hasPrevious()) { throw new NoSuchElementException("Already at start of list."); } if (next == null) { next = parent.root.get(nextIndex - 1); } else { next = next.previous(); } Object value = next.getValue(); current = next; currentIndex = --nextIndex; return value; }
public Object next() { checkModCount(); if (!hasNext()) { throw new NoSuchElementException("No element at index " + nextIndex + "."); } if (next == null) { next = parent.root.get(nextIndex); } Object value = next.getValue(); current = next; currentIndex = nextIndex++; next = next.next(); return value; }
/** * Locate the element with the given index relative to the * offset of the parent of this node. */ AVLNode get(int index) { int indexRelativeToMe = index - relativePosition; if (indexRelativeToMe == 0) { return this; } AVLNode nextNode = ((indexRelativeToMe < 0) ? getLeftSubTree() : getRightSubTree()); if (nextNode == null) { return null; } return nextNode.get(indexRelativeToMe); }
/** * Locate the element with the given index relative to the * offset of the parent of this node. */ AVLNode get(int index) { int indexRelativeToMe = index - relativePosition; if (indexRelativeToMe == 0) { return this; } AVLNode nextNode = ((indexRelativeToMe < 0) ? getLeftSubTree() : getRightSubTree()); if (nextNode == null) { return null; } return nextNode.get(indexRelativeToMe); }
public Object next() { checkModCount(); if (!hasNext()) { throw new NoSuchElementException("No element at index " + nextIndex + "."); } if (next == null) { next = parent.root.get(nextIndex); } Object value = next.getValue(); current = next; currentIndex = nextIndex++; next = next.next(); return value; }
/** * Gets the element at the specified index. * * @param index the index to retrieve * @return the element at the specified index */ public Object get(int index) { checkInterval(index, 0, size() - 1); return root.get(index).getValue(); }
/** * Gets the element at the specified index. * * @param index the index to retrieve * @return the element at the specified index */ public Object get(int index) { checkInterval(index, 0, size() - 1); return root.get(index).getValue(); }
/** * Gets the element at the specified index. * * @param index the index to retrieve * @return the element at the specified index */ public Object get(int index) { checkInterval(index, 0, size() - 1); return root.get(index).getValue(); }
/** * Gets the element at the specified index. * * @param index the index to retrieve * @return the element at the specified index */ public Object get(int index) { checkInterval(index, 0, size() - 1); return root.get(index).getValue(); }
/** * Gets the element at the specified index. * * @param index the index to retrieve * @return the element at the specified index */ public Object get(int index) { checkInterval(index, 0, size() - 1); return root.get(index).getValue(); }
/** * Sets the element at the specified index. * * @param index the index to set * @param obj the object to store at the specified index * @return the previous object at that index * @throws IndexOutOfBoundsException if the index is invalid */ public Object set(int index, Object obj) { checkInterval(index, 0, size() - 1); AVLNode node = root.get(index); Object result = node.value; node.setValue(obj); return result; }
/** * Locate the element with the given index relative to the * offset of the parent of this node. */ AVLNode get(int index) { int indexRelativeToMe = index - relativePosition; if (indexRelativeToMe == 0) { return this; } AVLNode nextNode = ((indexRelativeToMe < 0) ? getLeftSubTree() : getRightSubTree()); if (nextNode == null) { return null; } return nextNode.get(indexRelativeToMe); }
public Object previous() { checkModCount(); if (!hasPrevious()) { throw new NoSuchElementException("Already at start of list."); } if (next == null) { next = parent.root.get(nextIndex - 1); } else { next = next.previous(); } Object value = next.getValue(); current = next; currentIndex = --nextIndex; return value; }
/** * Create a ListIterator for a list. * * @param parent the parent list * @param fromIndex the index to start at */ protected TreeListIterator(TreeList parent, int fromIndex) throws IndexOutOfBoundsException { super(); this.parent = parent; this.expectedModCount = parent.modCount; this.next = (parent.root == null ? null : parent.root.get(fromIndex)); this.nextIndex = fromIndex; this.currentIndex = -1; }
/** * Locate the element with the given index relative to the * offset of the parent of this node. */ AVLNode get(int index) { int indexRelativeToMe = index - relativePosition; if (indexRelativeToMe == 0) { return this; } AVLNode nextNode = ((indexRelativeToMe < 0) ? getLeftSubTree() : getRightSubTree()); if (nextNode == null) { return null; } return nextNode.get(indexRelativeToMe); }
/** * Gets the element at the specified index. * * @param index the index to retrieve * @return the element at the specified index */ public Object get(int index) { checkInterval(index, 0, size() - 1); return root.get(index).getValue(); }
/** * Sets the element at the specified index. * * @param index the index to set * @param obj the object to store at the specified index * @return the previous object at that index * @throws IndexOutOfBoundsException if the index is invalid */ public Object set(int index, Object obj) { checkInterval(index, 0, size() - 1); AVLNode node = root.get(index); Object result = node.value; node.setValue(obj); return result; }
/** * Create a ListIterator for a list. * * @param parent the parent list * @param fromIndex the index to start at */ protected TreeListIterator(TreeList parent, int fromIndex) throws IndexOutOfBoundsException { super(); this.parent = parent; this.expectedModCount = parent.modCount; this.next = (parent.root == null ? null : parent.root.get(fromIndex)); this.nextIndex = fromIndex; this.currentIndex = -1; }
/** * Gets the element at the specified index. * * @param index the index to retrieve * @return the element at the specified index */ public Object get(int index) { checkInterval(index, 0, size() - 1); return root.get(index).getValue(); }