ProActive Programming

CircularArrayList.add(int,Collection) always adds to end of list

Details

  • Description:
    Hide
    org.objectweb.proactive.core.util.CircularArrayList.add(int, java.util.Collection) ignores the first argument. Also, the method is not as performant as its non-indexed counterpart since capacity is never ensured. Or maybe you don't want to call size()? At any rate, the implementations of add(int, Collection) and add(Collection) should be more closely aligned.
    Show
    org.objectweb.proactive.core.util.CircularArrayList.add(int, java.util.Collection) ignores the first argument. Also, the method is not as performant as its non-indexed counterpart since capacity is never ensured. Or maybe you don't want to call size()? At any rate, the implementations of add(int, Collection) and add(Collection) should be more closely aligned.

Activity

Hide
Clement Mathieu added a comment - 08/Apr/09 3:47 PM
Thanks for the report. addAll(int, Collection) had never been used in ProActive. I fixed it and it should be follow the contract defined by http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html#addAll(int, java.util.Collection) . In addition addAll(Collection) now calls c.addAll(c.size(), Collection).

Please note that addAll(int, Collection) is not heavily optimized. Cells are copied one by one instead of using System.arraycopy.

The patch is available in the trunk (#11868). Can you test it ? We have to decide if it should be applied to maintenance releases (4.0.4 and 4.1.1) or not.
Show
Clement Mathieu added a comment - 08/Apr/09 3:47 PM Thanks for the report. addAll(int, Collection) had never been used in ProActive. I fixed it and it should be follow the contract defined by http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html#addAll(int, java.util.Collection) . In addition addAll(Collection) now calls c.addAll(c.size(), Collection). Please note that addAll(int, Collection) is not heavily optimized. Cells are copied one by one instead of using System.arraycopy. The patch is available in the trunk (#11868). Can you test it ? We have to decide if it should be applied to maintenance releases (4.0.4 and 4.1.1) or not.
Hide
Hollis Waite added a comment - 08/Apr/09 5:16 PM
The updated code seems to work ok.
Show
Hollis Waite added a comment - 08/Apr/09 5:16 PM The updated code seems to work ok.
Hide
Clement Mathieu added a comment - 22/May/09 4:02 PM
Merged in 4.1.1
Show
Clement Mathieu added a comment - 22/May/09 4:02 PM Merged in 4.1.1

People

Dates

  • Created:
    07/Apr/09 9:16 PM
    Updated:
    18/Aug/10 4:18 PM
    Resolved:
    09/Apr/09 2:09 PM