JDK-6192476 : CopyOnWriteArraySet.iterator should explicitly say it uses list order
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-11-09
  • Updated: 2010-04-02
  • Resolved: 2005-09-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b51Fixed
Description
Doug Lea writes:

>Also, does CopyOnWriteArraySet guarantee order like LinkedHashSet? If 
>> so, I don't think it's documented. I think it should be documented 
>> either way, because it's ambiguous because the docs say it's based on 
>> CopyOnWriteArrayList, which guarantees order as a List.


Thanks. You are right that it should explicitly say that it uses list
order; it is now only implicit.

Josh and Martin:

Any objections to overriding CopyOnWriteArraySet.iterator
javadoc, that now just inherits:
  Returns an iterator over the elements contained in this collection.
To instead say:
  Returns an iterator over the elements contained in this collection
  in the order in which these elements were added.
###@###.### 2004-11-09 00:22:05 GMT

Comments
SUGGESTED FIX /** * Returns an iterator over the elements contained in this set * in the order in which these elements were added. * * <p>The returned iterator provides a snapshot of the state of the set * when the iterator was constructed. No synchronization is needed while * traversing the iterator. The iterator does <em>NOT</em> support the * <tt>remove</tt> method. * * @return an iterator over the elements in this set */ public Iterator<E> iterator() {
15-08-2005

EVALUATION Yup. ###@###.### 2004-11-09 00:24:16 GMT
09-11-2004