1 Jun 2004 13:48
need to use collection.sort w. CopyOnWriteArrayList but cant.....
Guy Katz <gkatz <at> allot.com>
2004-06-01 11:48:22 GMT
2004-06-01 11:48:22 GMT
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 <at> allot.com tel: +972 9 7619288 fax: +972 9 7443626
I would suggest that perhaps the easist thing for people who need the
inheritance hierachy, or some other class relationship is to create wrapper
classes that make the language of programming fit the discriptive language of
the problem domain. Then, you can change what you call, or work out different
details for your special case, and everyone can benefit from having a simpliar
base API that doesn't try to support a particular problem domain to the
exclusion of others.
-----
gregg <at> cytetech.com (Cyte Technologies Inc)
RSS Feed