Search code examples
javacollectionshashsetguava

Thread-safe HashSet with Guava Collections


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


Solution

  • This would be the right answer, Using the Sets class from Guava. Anyway the answer from @crhis was good intended.

    Sets.newSetFromMap(new ConcurrentHashMap<V, Boolean>());