private Label getOrCreateLabel(Map<T, Label> labelsByValue, T key) {
      Label label = labelsByValue.get(key);
      if (label == null) {
        labelsByValue.put(key, label = new Label());
      }
      return label;
    }
private Label getOrCreateLabel(Map<T, Label> labelsByValue, T key)