Пример #1
0
 /**
  * Returns a String representation of the linked list with a comma delimited list of all the
  * elements in the list.
  *
  * @return a String representation of the LinkedList.
  */
 public String toString() {
   LinkedListNode node = head.next;
   StringBuilder buf = new StringBuilder();
   while (node != head) {
     buf.append(node.toString()).append(", ");
     node = node.next;
   }
   return buf.toString();
 }