@Override public BooleanBigList subList(final long from, final long to) { ensureIndex(from); ensureIndex(to); if (from > to) throw new IndexOutOfBoundsException("Start index (" + from + ") is greater than end index (" + to + ")"); return new BooleanSubList(this, from, to); } /**
ensureIndex(index); return new BooleanBigListIterator() { long pos = index, last = -1;
/** * Adds all of the elements in the specified collection to this list (optional * operation). */ @Override public boolean addAll(long index, final Collection<? extends Boolean> c) { ensureIndex(index); final Iterator<? extends Boolean> i = c.iterator(); final boolean retVal = i.hasNext(); while (i.hasNext()) add(index++, i.next()); return retVal; } /**
/** * {@inheritDoc} * * <p> * This is a trivial iterator-based implementation. It is expected that * implementations will override this method with a more optimized version. */ @Override public void removeElements(final long from, final long to) { ensureIndex(to); BooleanBigListIterator i = listIterator(from); long n = to - from; if (n < 0) throw new IllegalArgumentException("Start index (" + from + ") is greater than end index (" + to + ")"); while (n-- != 0) { i.nextBoolean(); i.remove(); } } /**
/** * {@inheritDoc} * * <p> * This is a trivial iterator-based implementation. It is expected that * implementations will override this method with a more optimized version. */ @Override public void addElements(long index, final boolean a[][], long offset, long length) { ensureIndex(index); BooleanBigArrays.ensureOffsetLength(a, offset, length); while (length-- != 0) add(index++, BooleanBigArrays.get(a, offset++)); } /**