@Test(groups = { "serialization-hostile" }) public void testSpinedBuffer() { List<Integer> list1 = new ArrayList<>(); List<Integer> list2 = new ArrayList<>(); SpinedBuffer<Integer> sb = new SpinedBuffer<>(); for (int i = 0; i < TEST_SIZE; i++) { list1.add(i); sb.accept(i); } Iterator<Integer> it = sb.iterator(); for (int i = 0; i < TEST_SIZE; i++) list2.add(it.next()); assertFalse(it.hasNext()); assertEquals(list1, list2); for (int i = 0; i < TEST_SIZE; i++) assertEquals(sb.get(i), (Integer) i, Integer.toString(i)); list2.clear(); sb.forEach(list2::add); assertEquals(list1, list2); Integer[] array = sb.asArray(LambdaTestHelpers.integerArrayGenerator); list2.clear(); for (Integer i : array) list2.add(i); assertEquals(list1, list2); }
@SuppressWarnings("unchecked") public SpinedBuffer(int initialCapacity) { super(initialCapacity); curChunk = (E[]) new Object[1 << initialChunkPower]; }
SpinedBuffer extends AbstractSpinedBuffer implements Consumer<E>, Iterable<E> { @SuppressWarnings("unchecked") public SpinedBuffer(int initialCapacity) { super(initialCapacity); curChunk = (E[]) new Object[1 << initialChunkPower]; } }
SpinedBuffer extends AbstractSpinedBuffer implements Consumer<E>, Iterable<E> { @SuppressWarnings("unchecked") public SpinedBuffer(int initialCapacity) { super(initialCapacity); curChunk = (E[]) new Object[1 << initialChunkPower]; } @SuppressWarnings("unchecked")  SpinedBuffer(int initialCapacity); @SuppressWarnings("unchecked")  SpinedBuffer(); }
SpinedBuffer extends AbstractSpinedBuffer implements Consumer<E>, Iterable<E> { @SuppressWarnings("unchecked") public SpinedBuffer(int initialCapacity) { super(initialCapacity); curChunk = (E[]) new Object[1 << initialChunkPower]; } @SuppressWarnings("unchecked")  SpinedBuffer(int initialCapacity); @SuppressWarnings("unchecked")  SpinedBuffer(); E get(long index); void copyInto(E[] array, int offset); E[] asArray(IntFunction<E[]> arrayFactory); @Override void clear(); @Override Iterator<E> iterator(); @Override void forEach(Consumer<? super E> consumer); @Override void accept(E e); @Override String toString(); Spliterator<E> spliterator(); }
SpinedBuffer extends AbstractSpinedBuffer implements Consumer<E>, Iterable<E> { @SuppressWarnings("unchecked") public SpinedBuffer(int initialCapacity) { super(initialCapacity); curChunk = (E[]) new Object[1 << initialChunkPower]; } @SuppressWarnings("unchecked")  SpinedBuffer(int initialCapacity); @SuppressWarnings("unchecked")  SpinedBuffer(); E get(long index); void copyInto(E[] array, int offset); E[] asArray(IntFunction<E[]> arrayFactory); @Override void clear(); @Override Iterator<E> iterator(); @Override void forEach(Consumer<? super E> consumer); @Override void accept(E e); @Override String toString(); Spliterator<E> spliterator();  }