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(); }
public String toString() { String line = ""; LLNode<T> current = head; while (current != null) { line += current.getData().toString() + ","; current = current.getPointer(); } return line; }