private void cleanUpLabels(){
  int id=0;
  for (Iterator<Label> i=labels.iterator(); i.hasNext(); ) {
    Label label=i.next();
    if (label.isEmpty()) {
      i.remove();
    }
 else {
      label.compact();
      label.id=id++;
    }
  }
}

private void cleanUpLabels ( ) { int id = 0 ; for ( Iterator < Label > i = labels . iterator ( ) ; i . hasNext ( ) ; ) { Label label = i . next ( ) ; if ( label . isEmpty ( ) ) { i . remove ( ) ; } else { label . compact ( ) ; label . id = id ++ ; } } }
removes empty labels and assigns ids to non - empty labels .
