/** * Inserts the given element at the beginning of this list. */ public void addFirst(T element) { if(size==0) { first = new ListElement(element); } else { T tmp = first; first = new ListElement(element); first.next = tmp; } size++; }