@ Override public boolean addAll ( Collection < ? extends E > c ) { Object [ ] cs = c . toArray ( ) ; if ( cs . length == 0 ) return false ; final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { Object [ ] elements = getArray ( ) ; int len = elements . length ; Object [ ] newElements = Arrays . copyOf ( elements , len + cs . length ) ; System . arraycopy ( cs , 0 , newElements , len , cs . length ) ; setArray ( newElements ) ; return true ; } finally { lock . unlock ( ) ; } }
Appends all of the elements in the specified collection to the end of this list in the order that they are returned by the specified collection s iterator .