private static void updateStubIndices(
      @NotNull final Collection<StubIndexKey> indexKeys,
      final int inputId,
      @NotNull final Map<StubIndexKey, Map<Object, int[]>> oldStubTree,
      @NotNull final Map<StubIndexKey, Map<Object, int[]>> newStubTree) {
    final StubIndexImpl stubIndex = (StubIndexImpl) StubIndex.getInstance();
    for (StubIndexKey key : indexKeys) {
      final Map<Object, int[]> oldMap = oldStubTree.get(key);
      final Map<Object, int[]> newMap = newStubTree.get(key);

      final Map<Object, int[]> _oldMap =
          oldMap != null ? oldMap : Collections.<Object, int[]>emptyMap();
      final Map<Object, int[]> _newMap =
          newMap != null ? newMap : Collections.<Object, int[]>emptyMap();

      stubIndex.updateIndex(key, inputId, _oldMap, _newMap);
    }
  }