public int addAllAbsent(Collection<? extends E> c){
  Object[] cs=c.toArray();
  if (cs.length == 0)   return 0;
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    Object[] elements=getArray();
    int len=elements.length;
    int added=0;
    for (int i=0; i < cs.length; ++i) {
      Object e=cs[i];
      if (indexOf(e,elements,0,len) < 0 && indexOf(e,cs,0,added) < 0)       cs[added++]=e;
    }
    if (added > 0) {
      Object[] newElements=Arrays.copyOf(elements,len + added);
      System.arraycopy(cs,0,newElements,len,added);
      setArray(newElements);
    }
    return added;
  }
  finally {
    lock.unlock();
  }
}

public int addAllAbsent ( Collection < ? extends E > c ) { Object [ ] cs = c . toArray ( ) ; if ( cs . length == 0 ) return 0 ; final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { Object [ ] elements = getArray ( ) ; int len = elements . length ; int added = 0 ; for ( int i = 0 ; i < cs . length ; ++ i ) { Object e = cs [ i ] ; if ( indexOf ( e , elements , 0 , len ) < 0 && indexOf ( e , cs , 0 , added ) < 0 ) cs [ added ++ ] = e ; } if ( added > 0 ) { Object [ ] newElements = Arrays . copyOf ( elements , len + added ) ; System . arraycopy ( cs , 0 , newElements , len , added ) ; setArray ( newElements ) ; } return added ; } finally { lock . unlock ( ) ; } }
appends all of the elements in the specified collection that are not already contained in this list , to the end of this list , in the order that they are returned by the specified collection ' s iterator .
