private ArrayList<E> toArrayList(){
  ArrayList<E> list=new ArrayList<E>();
  for (Node<E> p=first(); p != null; p=succ(p)) {
    E item=p.item;
    if (item != null)     list.add(item);
  }
  return list;
}

private ArrayList < E > toArrayList ( ) { ArrayList < E > list = new ArrayList < E > ( ) ; for ( Node < E > p = first ( ) ; p != null ; p = succ ( p ) ) { E item = p . item ; if ( item != null ) list . add ( item ) ; } return list ; }
creates an array list and fills it with elements of this list . used by toarray .
