private ArrayList < E > toArrayList ( ) { ArrayList < E > list = new ArrayList <> ( ) ; 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 .