/** * Looks up a type using a temporary key, and if not present, creates * a permanent key and type. * * <p>This approach allows us to use a cheap temporary key. A permanent * key is more expensive, because it must be immutable and not hold * references into other data structures.</p> */ protected RelDataType canonize(final StructKind kind, final List<String> names, final List<RelDataType> types) { final RelDataType type = CACHE.getIfPresent(new Key(kind, names, types)); if (type != null) { return type; } final ImmutableList<String> names2 = ImmutableList.copyOf(names); final ImmutableList<RelDataType> types2 = ImmutableList.copyOf(types); return CACHE.getUnchecked(new Key(kind, names2, types2)); }
/** * Looks up a type using a temporary key, and if not present, creates * a permanent key and type. * * <p>This approach allows us to use a cheap temporary key. A permanent * key is more expensive, because it must be immutable and not hold * references into other data structures.</p> */ protected RelDataType canonize(final StructKind kind, final List<String> names, final List<RelDataType> types) { final RelDataType type = CACHE.getIfPresent(new Key(kind, names, types)); if (type != null) { return type; } final ImmutableList<String> names2 = ImmutableList.copyOf(names); final ImmutableList<RelDataType> types2 = ImmutableList.copyOf(types); return CACHE.getUnchecked(new Key(kind, names2, types2)); }