Thread-safe HashSet with Guava Collections

后端 未结 4 2249
攒了一身酷
攒了一身酷 2021-02-19 04:13

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

4条回答
  •  误落风尘
    2021-02-19 05:15

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

    Sets.newSetFromMap(new ConcurrentHashMap());
    

提交回复
热议问题