Is there any parallel LinkedHashSet in JDK6.0 or other libraries?

my throw follow exception code:

java.util.ConcurrentModificationException
        at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:761)
        at java.util.LinkedList$ListItr.next(LinkedList.java:696)
        at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
        at java.util.LinkedHashSet.<init>(LinkedHashSet.java:152)
        ...

I want to ConcurrentLinkedHashSetfix it

but I found ConcurrentSkipListSetin java.util.concurrent, this TreeSet, notLinkedHashSet

any way to get ConcurrentLinkedHashSetin jdk6.0?

thanks for the help:)

+5
source share
4 answers

A ConcurrentModificationException has nothing to do with concurrency in the form you are thinking about. It just means that, repeating the assembly, someone (perhaps your own code - this happens quite often;)) changes it, i.e. Adds / removes some values.

, Iterator , .

: , , , , /! -

synchronize(collection) {
   // do stuff here
}
+10

Collections.synchronizedMap(myMap);. (, , ) .

synchronizedMap:

() , . , , .

, ... .

,

  • get/put, , . concurrency , .

  • concurrency, , - , , hasNext == true (, ) ?

+4

ConcurrentLinkedHashMap - https://code.google.com/p/concurrentlinkedhashmap/

Set java.util.Collections.newSetFromMap(map)

+1

, . , ConcurrentHashMap ConcurrentLinkedQueue, ( O (N), )...

LinkedHashSet? ...

0

All Articles