@NotNull
  public static <K, V extends Map<?, ?>> V getOrCreate(Map<K, V> map, K key) {
    V res = map.get(key);
    if (res == null) {
      //noinspection unchecked
      res = (V)new HashMap<>();
      map.put(key, res);
    }

    return res;
  }
@NotNull
  public static <K, V extends Map<?, ?>> V getOrCreate(Map<K, V> map, K key)