@Test public void removeItemsFromABag() { RandomizedBag<Integer> bag = new RandomizedBag<>(SEED_ONE, baseItems); for (Integer e : shuffledBaseItemsWithSeedOne) { assertEquals("bag's head should follow the shuffling", e, bag.remove()); } }
public E remove() { if (isEmpty()) { throw new NoSuchElementException("Cannot remove an element from an empty bag."); } return elems.remove(0); }
RandomizedBag extends AbstractCollection<E> implements Externalizable { public E remove() { if (isEmpty()) { throw new NoSuchElementException("Cannot remove an element from an empty bag."); } return elems.remove(0); } }
RandomizedBag extends AbstractCollection<E> implements Externalizable { public E remove() { if (isEmpty()) { throw new NoSuchElementException("Cannot remove an element from an empty bag."); } return elems.remove(0); } RandomizedBag();  RandomizedBag(long seed);  RandomizedBag(Collection<E> c);  RandomizedBag(long seed, Collection<E> c); }
RandomizedBag extends AbstractCollection<E> implements Externalizable { public E remove() { if (isEmpty()) { throw new NoSuchElementException("Cannot remove an element from an empty bag."); } return elems.remove(0); } RandomizedBag();  RandomizedBag(long seed);  RandomizedBag(Collection<E> c);  RandomizedBag(long seed, Collection<E> c); @Override boolean add(E e); E remove(); Iterator<E> iterator(); @Override Spliterator<E> spliterator(); @Override int size(); @Override void writeExternal(ObjectOutput out); @SuppressWarnings("unchecked") @Override void readExternal(ObjectInput in); }
RandomizedBag extends AbstractCollection<E> implements Externalizable { public E remove() { if (isEmpty()) { throw new NoSuchElementException("Cannot remove an element from an empty bag."); } return elems.remove(0); } RandomizedBag();  RandomizedBag(long seed);  RandomizedBag(Collection<E> c);  RandomizedBag(long seed, Collection<E> c); @Override boolean add(E e); E remove(); Iterator<E> iterator(); @Override Spliterator<E> spliterator(); @Override int size(); @Override void writeExternal(ObjectOutput out); @SuppressWarnings("unchecked") @Override void readExternal(ObjectInput in);  }