Code example for Set

Methods: size

0
  public ChoosableSet(int initialSize) {
    ids = new ConcurrentHashSet<>(initialSize);
  } 
 
  public int size() { 
    return ids.size();
  } 
 
  public void add(T elem) {
    ids.add(elem);
  } 
 
  public void remove(T elem) {
    ids.remove(elem);
  } 
 
  public void merge(ChoosableSet<T> toMerge) {
    ids.addAll(toMerge.ids);
  } 
 
Experience pair programming with AI  Get Codota for Java