private K getStableKey(K key) {
    if (key instanceof ShareableKey) {
      //noinspection unchecked
      return (K)((ShareableKey)key).getStableCopy();
    }
    return key;
  }
private K getStableKey(K key)