/** * Extends this TemplateTypeMap with the contents of the specified map. UNKNOWN_TYPE will be used * as the value for any missing values in the specified map. */ TemplateTypeMap extend(TemplateTypeMap other) { ImmutableList<JSType> resizedOtherValues = other.resizedToMatchKeys(other.templateValues); return registry.createTemplateTypeMap( concatImmutableLists(other.templateKeys, templateKeys), concatImmutableLists(resizedOtherValues, templateValues)); }
/** * Extends this TemplateTypeMap with the contents of the specified map. * UNKNOWN_TYPE will be used as the value for any missing values in the * specified map. */ TemplateTypeMap extend(TemplateTypeMap thatMap) { thatMap = thatMap.addUnknownValues(); return registry.createTemplateTypeMap( concatImmutableLists(thatMap.templateKeys, templateKeys), concatImmutableLists(thatMap.templateValues, templateValues)); }
/** Returns a new TemplateTypeMap whose values have been extended with the specified list. */ TemplateTypeMap copyFilledWithValues(ImmutableList<JSType> additionalValues) { ImmutableList<JSType> finalValues = resizedToMatchKeys(concatImmutableLists(templateValues, additionalValues)); return registry.createTemplateTypeMap(templateKeys, finalValues); }
/** * Returns a new TemplateTypeMap whose values have been extended with the * specified list. */ TemplateTypeMap addValues(ImmutableList<JSType> newValues) { // Ignore any new template values that will not align with an existing // template key. int numUnfilledKeys = numUnfilledTemplateKeys(); if (numUnfilledKeys < newValues.size()) { newValues = newValues.subList(0, numUnfilledKeys); } return registry.createTemplateTypeMap( templateKeys, concatImmutableLists(templateValues, newValues)); }