public void addAll ( List < T > list ) { if ( list . isEmpty ( ) ) return ; Element < T > a = requestNew ( ) ; a . object = list . get ( 0 ) ; if ( first == null ) { first = a ; } else if ( last != null ) { last . next = a ; a . previous = last ; } for ( int i = 1 ; i < list . size ( ) ; i ++ ) { Element < T > b = requestNew ( ) ; b . object = list . get ( i ) ; a . next = b ; b . previous = a ; a = b ; } last = a ; size += list . size ( ) ; }
Add all elements in list into this linked list