private void remove(ThreadGroup g){
synchronized (groups) {
    for (Iterator<ThreadGroup> i=groups.iterator(); i.hasNext(); ) {
      ThreadGroup threadGroup=i.next();
      if (threadGroup.equals(g)) {
        i.remove();
        break;
      }
    }
  }
  destroyIfEmptyDaemon();
}

private void remove ( ThreadGroup g ) { synchronized ( groups ) { for ( Iterator < ThreadGroup > i = groups . iterator ( ) ; i . hasNext ( ) ; ) { ThreadGroup threadGroup = i . next ( ) ; if ( threadGroup . equals ( g ) ) { i . remove ( ) ; break ; } } } destroyIfEmptyDaemon ( ) ; }
removes an immediate subgroup .
