FoldedByteArrayIndexedList implements ByteArrayIndexedList { @Override public long getSizeInBytes() { final long elementSize = elements.stream() .mapToInt(UnsignedByteArray::length) .sum(); return Integer.BYTES + Integer.BYTES + sizeOfIndexOffsetValue * databaseDocumentsCount + Long.BYTES * offsets.size() + elementSize; } FoldedByteArrayIndexedList(
            @NotNull final Map<UnsignedByteArray, List<Integer>> elements,
            final int databaseDocumentsCount); @Override String toString(); @Override long getSizeInBytes(); @Override void writeTo(
            @NotNull final OutputStream os);  }
@Test public void checkSize() { final FoldedByteArrayIndexedList foldedList = new FoldedByteArrayIndexedList(initData(initString()), initString().size()); assertEquals(51, foldedList.getSizeInBytes()); }