Thread-safe HashSet with Guava Collections

santiagobasulto picture santiagobasulto · Sep 2, 2010 · Viewed 12.4k times · Source

Like the title says, i would like to get a thread-safe HashSet using Guava Collections.
Are any available?

Answer

Chris Jester-Young picture Chris Jester-Young · Sep 2, 2010
Set<K> set = Collections.newSetFromMap(new ConcurrentHashMap<K, Boolean>());