private static @NotNull <K> Map<K, StubIdList> deserializeIndexValue(@NotNull DataInput in,
                                                                       @NotNull StubIndexKey<K, ?> stubIndexKey,
                                                                       @Nullable K requestedKey) throws IOException {
    KeyDescriptor<K> keyDescriptor = StubIndexKeyDescriptorCache.INSTANCE.getKeyDescriptor(stubIndexKey);

    int bufferSize = DataInputOutputUtil.readINT(in);
    byte[] buffer = new byte[bufferSize];
    in.readFully(buffer);
    UnsyncByteArrayInputStream indexIs = new UnsyncByteArrayInputStream(buffer);
    DataInputStream indexDis = new DataInputStream(indexIs);
    HashingStrategy<K> hashingStrategy = StubIndexKeyDescriptorCache.INSTANCE.getKeyHashingStrategy(stubIndexKey);
    Map<K, StubIdList> result = CollectionFactory.createCustomHashingStrategyMap(hashingStrategy);
    while (indexDis.available() > 0) {
      ProgressManager.checkCanceled();
      K key = keyDescriptor.read(indexDis);
      StubIdList read = StubIdExternalizer.INSTANCE.read(indexDis);
      if (requestedKey == null) {
        result.put(key, read);
      }
      else if (hashingStrategy.equals(requestedKey, key)) {
        result.put(key, read);
        return result;
      }
    }
    return result;
  }
private static @NotNull <K> Map<K, StubIdList> deserializeIndexValue(@NotNull DataInput in,
                                                                       @NotNull StubIndexKey<K, ?> stubIndexKey,
                                                                       @Nullable K requestedKey)