Tuesday, 10 May 2016

[Java] How to create synchronized set.(동기화 Set 만드는 방법)

Java supports various synchronized collections in java.util.concurrent package.
ex) java.util.concurrent.BlockingQueue, java.util.concurrent.ConcurrentMap ...

But, the Set collection is not included in this package. You can create synchronized set like this.

1
public static final java.util.Set< String> INTERNAL_DEVICE_DEAD_SET = Collections.synchronizedSet( new HashSet< String>());

No comments:

Post a Comment