Пример #1
0
 public T getData(int index) {
   LLNode<T> node = head;
   if (index < 0) return null;
   for (int i = 0; i < index; i++) {
     node = node.getPointer();
   }
   return node.getData();
 }
Пример #2
0
 public String toString() {
   String line = "";
   LLNode<T> current = head;
   while (current != null) {
     line += current.getData().toString() + ",";
     current = current.getPointer();
   }
   return line;
 }