コード例 #1
0
ファイル: CopyOnWriteArraySet.java プロジェクト: jshjs11/xi
 /**
  * Creates a set containing all of the elements of the specified collection.
  *
  * @param c the collection of elements to initially contain
  * @throws NullPointerException if the specified collection is null
  */
 public CopyOnWriteArraySet(Collection<? extends E> c) {
   al = new CopyOnWriteArrayList<E>();
   al.addAllAbsent(c);
 }
コード例 #2
0
ファイル: CopyOnWriteArraySet.java プロジェクト: jshjs11/xi
 /**
  * Adds all of the elements in the specified collection to this set if they're not already
  * present. If the specified collection is also a set, the <tt>addAll</tt> operation effectively
  * modifies this set so that its value is the <i>union</i> of the two sets. The behavior of this
  * operation is undefined if the specified collection is modified while the operation is in
  * progress.
  *
  * @param c collection containing elements to be added to this set
  * @return <tt>true</tt> if this set changed as a result of the call
  * @throws NullPointerException if the specified collection is null
  * @see #add(Object)
  */
 public boolean addAll(Collection<? extends E> c) {
   return al.addAllAbsent(c) > 0;
 }