IntList (final IntList delegateList, final int blockSize) { if (blockSize < 1) throw new IllegalArgumentException("Unsupported blockSize:" + blockSize); if (delegateList.size() == 0) return new FullIntList(new int[0]); IntList intDeltaCompressor = SmartDeltaCompressor.newInstance(new IntList() { @Override public int size() { return delegateList.size(); } @Override public int get(int index) { return delegateList.get(index) - delegateList.get(index - (index % blockSize)); } }); int[] strongValues = new int[(delegateList.size() - 1) / blockSize + 1]; for (int i = 0; i < strongValues.length; i++) { strongValues[i] = delegateList.get(i * blockSize); } return new CompressedIntList(blockSize, strongValues, intDeltaCompressor); }