Code example for Enumeration

Methods: hasMoreElements

0
    this.first = first;
    this.second = second;
  } 
 
  public boolean hasMoreElements() { 
    return first.hasMoreElements() || second.hasMoreElements();
  } 
 
  public T nextElement() { 
    if (first.hasMoreElements()) {
      return first.nextElement();
    } else { 
      return second.nextElement();
    } 
  } 
}