Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SynchronizedSet in apache commons

Why is there Apache's Synchronized Set when we have Collection's SynchronizedSet?

Is it better in any way?

like image 975
pihentagy Avatar asked Feb 28 '26 12:02

pihentagy


1 Answers

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

like image 122
Peter Lawrey Avatar answered Mar 02 '26 03:03

Peter Lawrey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!