public void clean(){
  Iterator<Group> itr=groups.iterator();
  while (itr.hasNext()) {
    Group group=itr.next();
    group.clean();
    if (group.isEmpty()) {
      itr.remove();
    }
  }
}

public void clean ( ) { Iterator < Group > itr = groups . iterator ( ) ; while ( itr . hasNext ( ) ) { Group group = itr . next ( ) ; group . clean ( ) ; if ( group . isEmpty ( ) ) { itr . remove ( ) ; } } }
handles timeouts and removes empty groups
