util.concurrent 1.3.4

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

util.concurrent 1.3.4

Elias Ross-5

I know there is an existing bug with


but one interesting way I've come across this is with this sort of code:

ConcurrentReaderHashMap cr;
List l = new ArrayList();


What ends up happening is "null" entries end up getting added to the
ArrayList.  This is because, despite what the JavaDoc says:
        Appends all of the elements in the specified Collection to the
        end of this list, in the order that they are returned by the
        specified Collection's Iterator.
The code for ArrayList calls "toArray" on the set and ignores the

    public boolean addAll(Collection<? extends E> c) {
        Object[] a = c.toArray();

Concurrency-interest mailing list
[hidden email]