If the map is an EnumMap, it must have key type K for some <K extends Enum<K>>.
322723
@SuppressWarnings({"unchecked", "rawtypes"})
  private static <K, V> ImmutableMap<K, V> copyOfEnumMapUnsafe(Map<? extends K, ? extends V> map) {
    return copyOfEnumMap((EnumMap) map);
  }
659952
function(mapping, key) {
  // Set key
  this.key = key;

  // Set key type
  assert(mapping[this.key], 'key \'' + key + '\' is not defined in mapping');
  assert(mapping[this.key] instanceof Types.PositiveInteger,
    'key \'' + key + '\' must be a PositiveInteger type');
  this.type = mapping[this.key];

  // Set covers
  this.covers = [key];
}
1252616
public static <K extends Enum<K> & Keyed<String>> EnumLookup<K, String> of(final Class<K> enumClass,
                                                                               final boolean caseSensitive) {
        return new EnumLookup<K, String>(enumClass, -1, caseSensitive);
    }
668331
public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
		Assert.notNull(map, "'map' must not be null");
		Map<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size());
		for (Map.Entry<? extends K, ? extends List<? extends V>> entry : map.entrySet()) {
			List<V> values = Collections.unmodifiableList(entry.getValue());
			result.put(entry.getKey(), values);
		}
		Map<K, List<V>> unmodifiableMap = Collections.unmodifiableMap(result);
		return toMultiValueMap(unmodifiableMap);
	}
738225
public void setTypeMap(Map<Class<? extends T>, C> map) {
		this.classified = new ConcurrentHashMap<Class<? extends T>, C>(map);
	}
281746
public static <K, V> void putAll(Map<K, V> to, Map<? extends K, ? extends V> from) {
        if (to != null && from != null) {
            to.putAll(from);
        }
    }
1135852
public boolean containsKey(final Object k) {
    return this._current.containsKey(k)
        || (this._parent != null && this._parent.containsKey(k));
  }
1131941
public static <K extends Enum<K> & Keyed<V>, V> EnumLookup<K, V> of(final Class<K> enumClass) {
        return new EnumLookup<K, V>(enumClass, -1, false);
    }
1146509
public static <K, V, A> A ifPresentApply(
            Map<K, V> map,
            K key,
            Function<? super V, ? extends A> function)
    {
        if (map instanceof UnsortedMapIterable)
        {
            return ((MapIterable<K, V>) map).ifPresentApply(key, function);
        }
        V result = map.get(key);
        return MapIterate.isAbsent(result, map, key) ? null : function.valueOf(result);
    }
678001
@SuppressWarnings("unchecked") // worse case should be a ClassCastException
  /*
   * TODO(cpovirk): Consider requiring key to be a K here. But AtomicLongMapSubject isn't currently
   * parameterized, and if we're going to add a type parameter, I'd rather wait until after we
   * (hopefully) remove the other existing type parameters.
   */
  public void containsEntry(Object key, long value) {
    checkNotNull(key, "AtomicLongMap does not support null keys");
    long actualValue = ((AtomicLongMap<Object>) actual()).get(key);
    if (actualValue != value) {
      failWithActual("expected to contain entry", immutableEntry(key, value));
    }
  }
389078
public static <K, V> ImmutableSet<K> allKeys(final Iterable<? extends Map<K, V>> maps) {
    final ImmutableSet.Builder<K> builder = ImmutableSet.builder();

    for (final Map<K, V> map : maps) {
      builder.addAll(map.keySet());
    }

    return builder.build();
  }
1256494
static <K,V> K keyOrNull(TreeMapEntry<K,V> e) {
        return (e == null) ? null : e.key;
    }
344012
public static <K, V> Map<K, V> unmodifiableCopy(
        Map<? extends K, ? extends V> map)
    {
        return Collections.<K, V>unmodifiableMap(
            new LinkedHashMap<K, V>(map));
    }
587288
private Map<? extends String, ? extends Parameter> buildEnumConstParamMap() {
		Map<String, Parameter> paramMap = new HashMap<>();
		for (String packageName : enumConstantPackageNames) {
			if (StringUtils.isNotBlank(packageName)) {
				for (Class<? extends Enum<?>> targetClass : listupEnumClasses(packageName)) {
					makeEnumConstParamMap(paramMap, packageName, targetClass);
				}
			}
		}
		return paramMap;
	}
1288146
public static <K> void validateConfiguredKeyType(Class<K> keyType, K key) throws ClassCastException {
        if (Object.class != keyType) {
            // means that type checks is required
            if (!keyType.isAssignableFrom(key.getClass())) {
                throw new ClassCastException("Key '" + key + "' is not assignable to " + keyType);
            }
        }
    }
417078
private static <K extends Comparable<? super K>, V> Collection<@KeyFor("#1") K> sortedKeySet(
      Map<K, V> m) {
    ArrayList<@KeyFor("#1") K> theKeys = new ArrayList<>(m.keySet());
    Collections.sort(theKeys);
    return theKeys;
  }
766625
def p_map_type(self, p):
        ''''''
        p[0] = ast.MapType(key_type=p[3], value_type=p[5], annotations=p[7])