src/share/classes/java/util/AbstractCollection.java

Print this page

        

*** 78,97 **** public abstract int size(); /** * {@inheritDoc} * ! * <p>This implementation returns <tt>size() == 0</tt>. */ public boolean isEmpty() { return size() == 0; } /** * {@inheritDoc} * ! * <p>This implementation iterates over the elements in the collection, * checking each element in turn for equality with the specified element. * * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ --- 78,99 ---- public abstract int size(); /** * {@inheritDoc} * ! * @implSpec ! * This implementation returns <tt>size() == 0</tt>. */ public boolean isEmpty() { return size() == 0; } /** * {@inheritDoc} * ! * @implSpec ! * This implementation iterates over the elements in the collection, * checking each element in turn for equality with the specified element. * * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */
*** 110,120 **** } /** * {@inheritDoc} * ! * <p>This implementation returns an array containing all the elements * returned by this collection's iterator, in the same order, stored in * consecutive elements of the array, starting with index {@code 0}. * The length of the returned array is equal to the number of elements * returned by the iterator, even if the size of this collection changes * during iteration, as might happen if the collection permits --- 112,123 ---- } /** * {@inheritDoc} * ! * @implSpec ! * This implementation returns an array containing all the elements * returned by this collection's iterator, in the same order, stored in * consecutive elements of the array, starting with index {@code 0}. * The length of the returned array is equal to the number of elements * returned by the iterator, even if the size of this collection changes * during iteration, as might happen if the collection permits
*** 144,154 **** } /** * {@inheritDoc} * ! * <p>This implementation returns an array containing all the elements * returned by this collection's iterator in the same order, stored in * consecutive elements of the array, starting with index {@code 0}. * If the number of elements returned by the iterator is too large to * fit into the specified array, then the elements are returned in a * newly allocated array with length equal to the number of elements --- 147,158 ---- } /** * {@inheritDoc} * ! * @implSpec ! * This implementation returns an array containing all the elements * returned by this collection's iterator in the same order, stored in * consecutive elements of the array, starting with index {@code 0}. * If the number of elements returned by the iterator is too large to * fit into the specified array, then the elements are returned in a * newly allocated array with length equal to the number of elements
*** 247,257 **** // Modification Operations /** * {@inheritDoc} * ! * <p>This implementation always throws an * <tt>UnsupportedOperationException</tt>. * * @throws UnsupportedOperationException {@inheritDoc} * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc} --- 251,262 ---- // Modification Operations /** * {@inheritDoc} * ! * @implSpec ! * This implementation always throws an * <tt>UnsupportedOperationException</tt>. * * @throws UnsupportedOperationException {@inheritDoc} * @throws ClassCastException {@inheritDoc} * @throws NullPointerException {@inheritDoc}
*** 263,273 **** } /** * {@inheritDoc} * ! * <p>This implementation iterates over the collection looking for the * specified element. If it finds the element, it removes the element * from the collection using the iterator's remove method. * * <p>Note that this implementation throws an * <tt>UnsupportedOperationException</tt> if the iterator returned by this --- 268,279 ---- } /** * {@inheritDoc} * ! * @implSpec ! * This implementation iterates over the collection looking for the * specified element. If it finds the element, it removes the element * from the collection using the iterator's remove method. * * <p>Note that this implementation throws an * <tt>UnsupportedOperationException</tt> if the iterator returned by this
*** 302,312 **** // Bulk Operations /** * {@inheritDoc} * ! * <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} --- 308,319 ---- // Bulk Operations /** * {@inheritDoc} * ! * @implSpec ! * 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}
*** 321,331 **** } /** * {@inheritDoc} * ! * <p>This implementation iterates over the specified collection, and adds * each object returned by the iterator to this collection, in turn. * * <p>Note that this implementation will throw an * <tt>UnsupportedOperationException</tt> unless <tt>add</tt> is * overridden (assuming the specified collection is non-empty). --- 328,339 ---- } /** * {@inheritDoc} * ! * @implSpec ! * This implementation iterates over the specified collection, and adds * each object returned by the iterator to this collection, in turn. * * <p>Note that this implementation will throw an * <tt>UnsupportedOperationException</tt> unless <tt>add</tt> is * overridden (assuming the specified collection is non-empty).
*** 347,357 **** } /** * {@inheritDoc} * ! * <p>This implementation iterates over this collection, checking each * element returned by the iterator in turn to see if it's contained * in the specified collection. If it's so contained, it's removed from * this collection with the iterator's <tt>remove</tt> method. * * <p>Note that this implementation will throw an --- 355,366 ---- } /** * {@inheritDoc} * ! * @implSpec ! * This implementation iterates over this collection, checking each * element returned by the iterator in turn to see if it's contained * in the specified collection. If it's so contained, it's removed from * this collection with the iterator's <tt>remove</tt> method. * * <p>Note that this implementation will throw an
*** 381,391 **** } /** * {@inheritDoc} * ! * <p>This implementation iterates over this collection, checking each * element returned by the iterator in turn to see if it's contained * in the specified collection. If it's not so contained, it's removed * from this collection with the iterator's <tt>remove</tt> method. * * <p>Note that this implementation will throw an --- 390,401 ---- } /** * {@inheritDoc} * ! * @implSpec ! * This implementation iterates over this collection, checking each * element returned by the iterator in turn to see if it's contained * in the specified collection. If it's not so contained, it's removed * from this collection with the iterator's <tt>remove</tt> method. * * <p>Note that this implementation will throw an
*** 415,425 **** } /** * {@inheritDoc} * ! * <p>This implementation iterates over this collection, removing each * element using the <tt>Iterator.remove</tt> operation. Most * implementations will probably choose to override this method for * efficiency. * * <p>Note that this implementation will throw an --- 425,436 ---- } /** * {@inheritDoc} * ! * @implSpec ! * This implementation iterates over this collection, removing each * element using the <tt>Iterator.remove</tt> operation. Most * implementations will probably choose to override this method for * efficiency. * * <p>Note that this implementation will throw an