void (@NotNull StubIndexKey indexKey, @NotNull Object value) { Map<Object, int[]> map = myResult.get(indexKey); if (map == null) { map = myHashingStrategyFunction == null ? new HashMap<>() : CollectionFactory.createCustomHashingStrategyMap(myHashingStrategyFunction.apply((StubIndexKey<?, ?>)indexKey)); myResult.put(indexKey, map); } int[] list = map.get(value); if (list == null) { map.put(value, new int[] {myStubIdx}); } else { int lastNonZero = ArrayUtil.lastIndexOfNot(list, 0); if (lastNonZero >= 0 && list[lastNonZero] == myStubIdx) { // second and subsequent occurrence calls for the same value are no op return; } int lastZero = lastNonZero + 1; if (lastZero == list.length) { list = ArrayUtil.realloc(list, Math.max(4, list.length << 1)); map.put(value, list); } list[lastZero] = myStubIdx; } }