Thread-safe HashSet with Guava Collections

Viewed 13404

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

4 Answers

Java 8 introduces new way to create concurrent hash set - ConcurrentHashMap.newKeySet()

Set<K> set = ConcurrentHashMap.newKeySet();

It's shorter than wrapping in Collections.newSetFromMap

Related