Exemplo n.º 1
0
  public T set(int index, T indexValue) {
    if (index < 0 || index > size - 1) {
      throw new IndexOutOfBoundsException();
    }
    LNode current = start;
    // int tracker=0;
    for (int i = 0; i < index; i++) {
      current = current.getNext();
    }
    T save = current.getData();
    current.setData(indexValue);

    return save;
  }