Esempio n. 1
0
 // Adds element to this collection.
 // Precondition: element is not already in the collection
 public void add(T element) {
   if (node == null) {
     node = new LLNode<T>(element);
     size++;
   } else {
     LLNode<T> temp = node;
     while (temp.getLink() != null) {
       temp = temp.getLink();
     }
     temp.setLink(new LLNode<T>(element));
     size++;
   }
 }