United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6192476 : CopyOnWriteArraySet.iterator should explicitly say it uses list order

Details
Type:
Bug
Submit Date:
2004-11-09
Status:
Resolved
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2005-09-04
Component:
core-libs
OS:
generic
Sub-Component:
java.util.concurrent
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports

Sub Tasks

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
EVALUATION

Yup.
###@###.### 2004-11-09 00:24:16 GMT
                                     
2004-11-09
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() {
                                     
2005-08-15



Hardware and Software, Engineered to Work Together