开发者

SynchronizedSet in apache commons

Why is开发者_如何学Go there Apache's Synchronized Set when we have Collection's SynchronizedSet?

Is it better in any way?


It depends on what you want to do. Apache's synchronized set allows you to get the underlying set. It is probably provide for consistency. The Collections method is standard.

You might consider using one of the concurrent sets like Collections.setFromMap(new ConcurrentHashMap()), CopyOnWriteArraySet or ConcurrentSkipListSet


My guess is because it allows you to specify a custom lock object.

The constructor is protected but you can subclass it and pass a custom lock.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜