-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ConcurrentHashMap for possible concurrent execution in the future
- Loading branch information
1 parent
bdcb452
commit 0f91ab3
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0f91ab3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh! It wouldn't have occurred to me to look in
ConcurrentHashMap
for a method to produce aConcurrentHashSet
- I would've probably gone forCollections.newSetFromMap(new ConcurrentHashMap<>)
instead, without really knowing if it produced thread-safe behaviour.One learns something new everyday. 😉
0f91ab3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just the new way of doing it in Java 8.
See: http://stackoverflow.com/questions/32054517/concurrenthashmap-newkeyset-vs-collections-newsetfrommap