Skip to content

Commit

Permalink
updated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jdereg committed Apr 29, 2024
1 parent f175031 commit f6892d8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/cedarsoftware/util/ConcurrentSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import java.util.concurrent.ConcurrentHashMap;

/**
* ConcurrentSet provides a Set that is thread-safe, usable in highly concurrent environments. It provides
* a no-arg constructor that will directly return a ConcurrentSet that is thread-safe. It has a constructor
* that takes a Collection argument and populates its internal Concurrent Set delegate implementation.
* <br>
* @author John DeRegnaucourt ([email protected])
* <br>
* Copyright (c) Cedar Software LLC
Expand All @@ -25,10 +29,18 @@
public class ConcurrentSet<T> implements Set<T> {
private final Set<T> set;

/**
* Create a new empty ConcurrentSet.
*/
public ConcurrentSet() {
set = ConcurrentHashMap.newKeySet();
}

/**
* Create a new ConcurrentSet instance with data from the passed in Collection. This data is populated into the
* internal set.
* @param col
*/
public ConcurrentSet(Collection<T> col) {
set = ConcurrentHashMap.newKeySet(col.size());
set.addAll(col);
Expand Down

0 comments on commit f6892d8

Please sign in to comment.