הכנסה לסוף הרשימה – גנרי

public static
<T> Node<T> insertIntoListEnd(Node<T>
first,T value){

      Node<T>
p = new
Node<T>(
value);

      if (first == null)

            return p;

      Node<T>
tmp = first;

      while (tmp.hasNext())

            tmp = tmp.getNext();

      tmp.setNext(p);

      return first;          

      }