Code example for Set

Methods: isEmptyiterator

0
  public Iterator<T> iterator() {
    return ids.iterator();
  } 
 
  public synchronized T choose() { 
    if (!ids.isEmpty()) {
      if (iter == null || !iter.hasNext()) {
        iter = ids.iterator();
      } 
      try { 
        return iter.next();
      } catch (NoSuchElementException e) {
        return null; 
      } 
    } else { 
      return null; 
    } 
  } 
} 
Experience pair programming with AI  Get Codota for Java