コード例 #1
0
 /**
  * {@inheritDoc}
  *
  * <p>
  *
  * <p>This implementation iterates over the specified collection, checking each element returned
  * by the iterator in turn to see if it's contained in this collection. If all elements are so
  * contained <tt>true</tt> is returned, otherwise <tt>false</tt>.
  *
  * @throws ClassCastException {@inheritDoc}
  * @throws NullPointerException {@inheritDoc}
  * @see #contains(int)
  */
 public boolean containsAll(IntCollection c) {
   IntIterator e = c.iterator();
   while (e.hasNext()) {
     if (!contains(e.next())) {
       return false;
     }
   }
   return true;
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  *
  * <p>
  *
  * <p>This implementation iterates over the specified collection, and adds each object returned by
  * the iterator to this collection, in turn.
  *
  * <p>
  *
  * <p>Note that this implementation will throw an <tt>UnsupportedOperationException</tt> unless
  * <tt>add</tt> is overridden (assuming the specified collection is non-empty).
  *
  * @throws UnsupportedOperationException {@inheritDoc}
  * @throws ClassCastException {@inheritDoc}
  * @throws NullPointerException {@inheritDoc}
  * @throws IllegalArgumentException {@inheritDoc}
  * @throws IllegalStateException {@inheritDoc}
  * @see #add(int)
  */
 public boolean addAll(IntCollection c) {
   boolean modified = false;
   IntIterator e = c.iterator();
   while (e.hasNext()) {
     if (add(e.next())) {
       modified = true;
     }
   }
   return modified;
 }