/** * Gets a ListIterator over the list. * * @param fromIndex the index to start from * @return the new iterator */ public ListIterator listIterator(int fromIndex) { // override to go 75% faster // cannot use EmptyIterator as iterator.add() must work checkInterval(fromIndex, 0, size()); return new TreeListIterator(this, fromIndex); }
/** * Gets a ListIterator over the list. * * @param fromIndex the index to start from * @return the new iterator */ public ListIterator listIterator(int fromIndex) { // override to go 75% faster // cannot use EmptyIterator as iterator.add() must work checkInterval(fromIndex, 0, size()); return new TreeListIterator(this, fromIndex); }
/** * 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(); }
/** * Removes the element at the specified index. * * @param index the index to remove * @return the previous object at that index */ public Object remove(int index) { modCount++; checkInterval(index, 0, size() - 1); Object result = get(index); root = root.remove(index); size--; return result; }
/** * 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; }
/** * Adds a new element to the list. * * @param index the index to add before * @param obj the element to add */ public void add(int index, Object obj) { modCount++; checkInterval(index, 0, size()); if (root == null) { root = new AVLNode(index, obj, null, null); } else { root = root.insert(index, obj); } size++; }
/** * Removes the element at the specified index. * * @param index the index to remove * @return the previous object at that index */ public Object remove(int index) { modCount++; checkInterval(index, 0, size() - 1); Object result = get(index); root = root.remove(index); size--; return result; }
/** * 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; }
/** * Adds a new element to the list. * * @param index the index to add before * @param obj the element to add */ public void add(int index, Object obj) { modCount++; checkInterval(index, 0, size()); if (root == null) { root = new AVLNode(index, obj, null, null); } else { root = root.insert(index, obj); } size++; }
/** * Gets a ListIterator over the list. * * @param fromIndex the index to start from * @return the new iterator */ public ListIterator listIterator(int fromIndex) { // override to go 75% faster // cannot use EmptyIterator as iterator.add() must work checkInterval(fromIndex, 0, size()); return new TreeListIterator(this, fromIndex); }
/** * Gets a ListIterator over the list. * * @param fromIndex the index to start from * @return the new iterator */ public ListIterator listIterator(int fromIndex) { // override to go 75% faster // cannot use EmptyIterator as iterator.add() must work checkInterval(fromIndex, 0, size()); return new TreeListIterator(this, fromIndex); }
/** * Gets a ListIterator over the list. * * @param fromIndex the index to start from * @return the new iterator */ public ListIterator listIterator(int fromIndex) { // override to go 75% faster // cannot use EmptyIterator as iterator.add() must work checkInterval(fromIndex, 0, size()); return new TreeListIterator(this, fromIndex); }
/** * Gets a ListIterator over the list. * * @param fromIndex the index to start from * @return the new iterator */ public ListIterator listIterator(int fromIndex) { // override to go 75% faster // cannot use EmptyIterator as iterator.add() must work checkInterval(fromIndex, 0, size()); return new TreeListIterator(this, fromIndex); }
/** * Gets a ListIterator over the list. * * @param fromIndex the index to start from * @return the new iterator */ public ListIterator listIterator(int fromIndex) { // override to go 75% faster // cannot use EmptyIterator as iterator.add() must work checkInterval(fromIndex, 0, size()); return new TreeListIterator(this, fromIndex); }
/** * 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(); }