[concurrency-interest] need to use collection.sort w. CopyOnWriteArrayList but cant.....

Guy Katz gkatz@allot.com
Tue, 1 Jun 2004 13:48:22 +0200


hi;
i am using CopyOnWriteArrayList.
i need ot add sort capability and tried doing it through the
Collections.sort but this fails cause the sort method eventually calls the
set method on the list iterator and this is not supported in the
CopyOnWriteArrayList.
do i have alternatives? i want to keep using the CopyOnWriteArrayList - it
fits my needs (multi thread env, small ammout of modifications a lot of
reads using the list iterator).
thanks in advance.

the exception:
java.lang.UnsupportedOperationException
	at
EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList$COWIterator.set(Unknow
n Source)
	at java.util.Collections.sort(Collections.java:117)
	at components.Test.doit(Test.java:38)

____________________
Guy Katz
Allot Communications
gkatz@allot.com
tel: +972 9 7619288
fax: +972 9 7443626