/** * {@inheritDoc} Delegates to the type-specific {@code rem()} method implemented * by type-specific abstract {@link java.util.Collection} superclass. */ @Override public boolean remove(boolean k) { return super.rem(k); } /**
@Override public boolean[] toBooleanArray() { return toArray((boolean[]) null); } /**
/** * {@inheritDoc} * * <p> * This implementation iterates over the elements in the collection, looking for * the specified element. */ @Override public boolean contains(final boolean k) { final BooleanIterator iterator = iterator(); while (iterator.hasNext()) if (k == iterator.nextBoolean()) return true; return false; } /**
@Override public boolean addAll(final BooleanCollection c) { boolean retVal = false; for (final BooleanIterator i = c.iterator(); i.hasNext();) if (add(i.nextBoolean())) retVal = true; return retVal; } @Override
@Override public boolean containsAll(final BooleanCollection c) { for (final BooleanIterator i = c.iterator(); i.hasNext();) if (!contains(i.nextBoolean())) return false; return true; } @Override
/** * {@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 boolean k) { final BooleanIterator iterator = iterator(); while (iterator.hasNext()) if (k == iterator.nextBoolean()) { iterator.remove(); return true; } return false; } /**
@Override public String toString() { final StringBuilder s = new StringBuilder(); final BooleanIterator i = iterator(); int n = size(); boolean k; boolean first = true; s.append("{"); while (n-- != 0) { if (first) first = false; else s.append(", "); k = i.nextBoolean(); s.append(String.valueOf(k)); } s.append("}"); return s.toString(); } }
@Override public boolean retainAll(final BooleanCollection c) { boolean retVal = false; for (final BooleanIterator i = iterator(); i.hasNext();) if (!c.contains(i.nextBoolean())) { i.remove(); retVal = true; } return retVal; } @Override
@Override public boolean removeAll(final BooleanCollection c) { boolean retVal = false; for (final BooleanIterator i = c.iterator(); i.hasNext();) if (rem(i.nextBoolean())) retVal = true; return retVal; } @Override
/** * {@inheritDoc} * * @deprecated Please use {@code toArray()} instead—this method is * redundant and will be removed in the future. */ @Deprecated @Override public boolean[] toBooleanArray(final boolean a[]) { return toArray(a); } @Override