protected static FrequencySet<String> combineMax(FrequencySet<String> a, FrequencySet<String> b) {
		FrequencySet<String> result = combineAndClip(a, b, 1);
		for (Map.Entry<String, MutableInt> entry : a.entrySet()) {
			result.get(entry.getKey()).v = entry.getValue().v;
		}

		for (Map.Entry<String, MutableInt> entry : b.entrySet()) {
			MutableInt slot = result.get(entry.getKey());
			slot.v = Math.max(slot.v, entry.getValue().v);
		}

		return result;
	}
Generate a frequency set as the union of two input sets. If an
element is contained in both sets, the value for the output will be
the maximum of the two input values.

@param a The first set.
@param b The second set.
@return The union of the two sets, with the maximum value chosen
whenever both sets contain the same key.
tool/src/org/antlr/v4/codegen/model/ElementFrequenciesVisitor.java