[concurrency-interest] A threadsafe list with a high number of writes and a low number of reads.
Rémi Forax
forax at univ-mlv.fr
Tue Jun 3 11:08:32 EDT 2008
Peter Veentjer a écrit :
> The CopyOnWriteArrayList is a threadsafe list that is useful if the
> number of reads is much larger than the number of writes. But what if
> you have the requirement for a List where the number of writes is a
> lot larger than the number of reads?
>
Making LinkedList a java.util.List was an error, by example
LinkedList list = ...
for(int i=0;i<list.size();i++)
System.out.println(list.get(i));
is quadratic.
Java 1.5 introduces a new interface java.util.Queue,
a queue is a list without access using index.
One threadsafe queue is:
ConcurrentLinkedQueue ?
> And if there are no List alternatives, are there other collection
> classes that are better suited for a high percentage of writes?
>
regards,
Rémi
More information about the Concurrency-interest
mailing list