/** * Returns {@code true} if the iteration has more elements. * (In other words, returns {@code true} if {@link #next} would * return an element rather than throwing an exception.) * * @return {@code true} if the iteration has more elements */ @Override public boolean hasNext() { return iterator.hasNext(); }
/** * Returns the next element in the iteration. * * @return the next element in the iteration * @throws java.util.NoSuchElementException if the iteration has no more elements */ @Override public Boolean next() { byte b = iterator.nextByte(); if (b == (byte) 0) { return false; } if (b == (byte) 1) { return true; } return null; } }
/** Stores the element returned by an iterator to a given data output. * * @param i an iterator whose output will be written to {@code dataOutput}. * @param dataOutput a filename. */ public static void storeBytes(final ByteIterator i, final DataOutput dataOutput) throws IOException { while(i.hasNext()) dataOutput.writeByte(i.nextByte()); } /** Stores the element returned by an iterator to a file given by a {@link File} object.
/** * {@inheritDoc} * * <p> * This implementation iterates over the elements in the collection, looking for * the specified element and tries to remove it. */ @Override public boolean rem(final byte k) { final ByteIterator iterator = iterator(); while (iterator.hasNext()) if (k == iterator.nextByte()) { iterator.remove(); return true; } return false; } /**
@Override public void remove() { iterator.remove(); } @Override
@Override public int skip(final int n) { return iterator.skip(n); } }
/** * Returns the next element in the iteration. * * @return the next element in the iteration * @throws java.util.NoSuchElementException if the iteration has no more elements */ @Override public Boolean next() { byte b = iterator.next(); if (b == (byte) 0) { return false; } if (b == (byte) 1) { return true; } return null; } }
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default void forEachRemaining(final Consumer<? super Byte> action) { forEachRemaining((ByteConsumer) action::accept); } /**
/** Stores the element returned by an iterator to a given print stream. * * @param i an iterator whose output will be written to {@code stream}. * @param stream a print stream. */ public static void storeBytes(final ByteIterator i, final PrintStream stream) { while(i.hasNext()) stream.println(i.nextByte()); } /** Stores the element returned by an iterator to a file given by a {@link File} object.
@Override public void remove() { iterator.remove(); } @Override
@Override public int skip(final int n) { return iterator.skip(n); } }
public Selection isEqualTo(BooleanColumn other) { Selection results = new BitmapBackedSelection(); int i = 0; ByteIterator booleanIterator = other.byteIterator(); for (byte next : data) { if (next == booleanIterator.nextByte()) { results.add(i); } i++; } return results; }
/** * Remove from this collection all elements which satisfy the given predicate. * * @param filter * a predicate which returns {@code true} for elements to be removed. * @see Collection#removeIf(java.util.function.Predicate) * @return {@code true} if any elements were removed. */ @SuppressWarnings("overloads") default boolean removeIf(final java.util.function.IntPredicate filter) { java.util.Objects.requireNonNull(filter); boolean removed = false; final ByteIterator each = iterator(); while (each.hasNext()) { if (filter.test(each.nextByte())) { each.remove(); removed = true; } } return removed; } /**
@Override public boolean hasNext() { return i.hasNext(); } @Override
@Override public void remove() { iterator.remove(); } @Override
@Override public int skip(final int n) { return iterator.skip(n); } }