BekIntMap (final List<Integer> result) { final int[] reverseMap = new int[result.size()]; for (int i = 0; i < result.size(); i++) { reverseMap[result.get(i)] = i; } final IntList compressedBekMap = CompressedIntList.newInstance(new IntList() { @Override public int size() { return result.size(); } @Override public int get(int index) { return result.get(index); } }, CompressedIntList.DEFAULT_BLOCK_SIZE); final IntList compressedReverseMap = CompressedIntList.newInstance(reverseMap); return new BekIntMap() { @Override public int size() { return compressedBekMap.size(); } @Override public int getBekIndex(int usualIndex) { return compressedReverseMap.get(usualIndex); } @Override public int getUsualIndex(int bekIndex) { return compressedBekMap.get(bekIndex); } }; }