Exemple #1
0
 /**
  * Deletes the item at the specified index.
  *
  * @param index The index of the item to delete.
  * @exception IllegalArgumentException If the index is not valid
  */
 public void remove(int index) throws IllegalArgumentException {
   items.removeElementAt(index);
   if (peer != null) {
     ListPeer l = (ListPeer) peer;
     l.delItems(index, index);
   }
 }
Exemple #2
0
  /**
   * Deletes all items in the specified index range.
   *
   * @param start The beginning index of the range to delete.
   * @param end The ending index of the range to delete.
   * @exception IllegalArgumentException If the indexes are not valid
   * @deprecated This method is deprecated for some unknown reason.
   */
  public synchronized void delItems(int start, int end) throws IllegalArgumentException {
    if ((start < 0) || (start >= items.size()))
      throw new IllegalArgumentException("Bad list start index value: " + start);

    if ((start < 0) || (start >= items.size()))
      throw new IllegalArgumentException("Bad list start index value: " + start);

    if (start > end) throw new IllegalArgumentException("Start is greater than end!");

    // We must run the loop in reverse direction.
    for (int i = end; i >= start; --i) items.removeElementAt(i);
    if (peer != null) {
      ListPeer l = (ListPeer) peer;
      l.delItems(start, end);
    }
  }