RFR  Speedup construction of CopyOnWriteArraySet in special cases
ivan.gerasimov at oracle.com
Tue Apr 30 11:41:13 UTC 2013
Would you please review my proposal to change constructor of
Currently, the body of the constructor is like this:
al = new CopyOnWriteArrayList<E>();
The addAllAbsent() function has O(c.length^2) complexity, so
construction time quickly grows with the input size.
However, if we knew that c is a Set, we could construct the COWAS in
And if the c was known to be another COWAS, we could simply clone the
The webrew also includes a test I used to make sure nothing is broken.
More information about the core-libs-dev