@Test public void whenAppendNonEmpty_SizeShouldEqualSumOfSizes() { RoaringArray array = new RoaringArray(); array.size = 2; array.keys = new char[]{0, 2, 0, 0}; array.values = new Container[4]; RoaringArray appendage = new RoaringArray(); appendage.size = 3; appendage.keys = new char[]{5, 6, 7, 0}; appendage.values = new Container[4]; array.append(appendage); assertEquals(5, array.size); }
@Override public void append(char key, Container value) { if (size > 0 && key < keys[size - 1]) { throw new IllegalArgumentException("append only: " + (key) + " < " + (keys[size - 1])); } extendArray(1); keys[size] = key; values[size] = value; size++; }
RoaringArray implements Cloneable, Externalizable, AppendableStorage<Container> { @Override public void append(char key, Container value) { if (size > 0 && key < keys[size - 1]) { throw new IllegalArgumentException("append only: " + (key) + " < " + (keys[size - 1])); } extendArray(1); keys[size] = key; values[size] = value; size++; } }
RoaringArray implements Cloneable, Externalizable, AppendableStorage<Container> { @Override public void append(char key, Container value) { if (size > 0 && key < keys[size - 1]) { throw new IllegalArgumentException("append only: " + (key) + " < " + (keys[size - 1])); } extendArray(1); keys[size] = key; values[size] = value; size++; } protected  RoaringArray();   RoaringArray(int initialCapacity);   RoaringArray(char[] keys, Container[] values, int size); }
RoaringArray implements Cloneable, Externalizable, AppendableStorage<Container> { @Override public void append(char key, Container value) { if (size > 0 && key < keys[size - 1]) { throw new IllegalArgumentException("append only: " + (key) + " < " + (keys[size - 1])); } extendArray(1); keys[size] = key; values[size] = value; size++; } protected  RoaringArray();   RoaringArray(int initialCapacity);   RoaringArray(char[] keys, Container[] values, int size); @Override void append(char key, Container value); void trim(); @Override RoaringArray clone(); void deserialize(DataInput in); void deserialize(DataInput in, byte[] buffer); void deserialize(ByteBuffer bbf); @Override boolean equals(Object o); ContainerPointer getContainerPointer(); ContainerPointer getContainerPointer(final int startIndex); @Override int hashCode(); @Override void readExternal(ObjectInput in); void serialize(DataOutput out); void serialize(ByteBuffer buffer); int serializedSizeInBytes(); @Override void writeExternal(ObjectOutput out); int first(); int last(); }
RoaringArray implements Cloneable, Externalizable, AppendableStorage<Container> { @Override public void append(char key, Container value) { if (size > 0 && key < keys[size - 1]) { throw new IllegalArgumentException("append only: " + (key) + " < " + (keys[size - 1])); } extendArray(1); keys[size] = key; values[size] = value; size++; } protected  RoaringArray();   RoaringArray(int initialCapacity);   RoaringArray(char[] keys, Container[] values, int size); @Override void append(char key, Container value); void trim(); @Override RoaringArray clone(); void deserialize(DataInput in); void deserialize(DataInput in, byte[] buffer); void deserialize(ByteBuffer bbf); @Override boolean equals(Object o); ContainerPointer getContainerPointer(); ContainerPointer getContainerPointer(final int startIndex); @Override int hashCode(); @Override void readExternal(ObjectInput in); void serialize(DataOutput out); void serialize(ByteBuffer buffer); int serializedSizeInBytes(); @Override void writeExternal(ObjectOutput out); int first(); int last();  }