[jdom-interest] Bug in ContentList.addAll(int,Collection)

Attila Szegedi szegedia at freemail.hu
Thu Apr 17 06:09:06 PDT 2003


Bug in ContentList.addAll(int,Collection)> The remove lines should be:
>             for (int i = 0; i < count; i++) {
>                 remove(index);
>             }
>

Even better - to avoid unnecessary shifting of elements that will get
removed anyway you can remove backward. Use

for (int i = index + count; i-->index;) {
    remove(i);
}

Attila.





More information about the jdom-interest mailing list