@Test void serializationTest() { Bitlist bitlist = createBitlist(); Bytes bitlistSerialized = bitlist.serialize(); Assertions.assertEquals(bitlistSerialized.toHexString(), "0x721806"); }
@SuppressWarnings("NarrowingCompoundAssignment") public Bytes serialize() { int len = size; byte[] array = new byte[sszSerializationLength(len)]; IntStream.range(0, len).forEach(i -> array[i / 8] |= ((data.get(i) ? 1 : 0) << (i % 8))); array[len / 8] |= 1 << (len % 8); return Bytes.wrap(array); }
Bitlist { @SuppressWarnings("NarrowingCompoundAssignment") public Bytes serialize() { int len = size; byte[] array = new byte[sszSerializationLength(len)]; IntStream.range(0, len).forEach(i -> array[i / 8] |= ((data.get(i) ? 1 : 0) << (i % 8))); array[len / 8] |= 1 << (len % 8); return Bytes.wrap(array); } }
Bitlist { @SuppressWarnings("NarrowingCompoundAssignment") public Bytes serialize() { int len = size; byte[] array = new byte[sszSerializationLength(len)]; IntStream.range(0, len).forEach(i -> array[i / 8] |= ((data.get(i) ? 1 : 0) << (i % 8))); array[len / 8] |= 1 << (len % 8); return Bytes.wrap(array); } Bitlist(int arraySize, long maxSize);  Bitlist(Bitlist bitlist); private  Bitlist(int size, BitSet data, long maxSize); }
Bitlist { @SuppressWarnings("NarrowingCompoundAssignment") public Bytes serialize() { int len = size; byte[] array = new byte[sszSerializationLength(len)]; IntStream.range(0, len).forEach(i -> array[i / 8] |= ((data.get(i) ? 1 : 0) << (i % 8))); array[len / 8] |= 1 << (len % 8); return Bytes.wrap(array); } Bitlist(int arraySize, long maxSize);  Bitlist(Bitlist bitlist); private  Bitlist(int size, BitSet data, long maxSize); void setBit(int i); void setBits(int... indexes); boolean getBit(int i); int getBitCount(); boolean intersects(Bitlist other); boolean isSuperSetOf(final Bitlist other); List<Integer> getAllSetBits(); IntStream streamAllSetBits(); void setAllBits(Bitlist other); long getMaxSize(); int getCurrentSize(); @SuppressWarnings("NarrowingCompoundAssignment") Bytes serialize(); static int sszSerializationLength(final int size); static Bitlist fromBytes(Bytes bytes, long maxSize); Bitlist copy(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
Bitlist { @SuppressWarnings("NarrowingCompoundAssignment") public Bytes serialize() { int len = size; byte[] array = new byte[sszSerializationLength(len)]; IntStream.range(0, len).forEach(i -> array[i / 8] |= ((data.get(i) ? 1 : 0) << (i % 8))); array[len / 8] |= 1 << (len % 8); return Bytes.wrap(array); } Bitlist(int arraySize, long maxSize);  Bitlist(Bitlist bitlist); private  Bitlist(int size, BitSet data, long maxSize); void setBit(int i); void setBits(int... indexes); boolean getBit(int i); int getBitCount(); boolean intersects(Bitlist other); boolean isSuperSetOf(final Bitlist other); List<Integer> getAllSetBits(); IntStream streamAllSetBits(); void setAllBits(Bitlist other); long getMaxSize(); int getCurrentSize(); @SuppressWarnings("NarrowingCompoundAssignment") Bytes serialize(); static int sszSerializationLength(final int size); static Bitlist fromBytes(Bytes bytes, long maxSize); Bitlist copy(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }