@Override @Test public void select() { BooleanIterable iterable = this.classUnderTest(); Verify.assertSize(1, iterable.select(BooleanPredicates.isFalse())); Verify.assertSize(2, iterable.select(BooleanPredicates.isTrue())); }
public BooleanHashSet withAll(BooleanIterable elements) { if (this.state == 3) { return this; } this.addAll(elements.toArray()); return this; }
public static BooleanHashSet newSet(BooleanIterable source) { if (source instanceof BooleanHashSet) { return new BooleanHashSet((BooleanHashSet) source); } return BooleanHashSet.newSetWith(source.toArray()); }
public boolean removeAll(BooleanIterable source) { if (this.isEmpty() || source.isEmpty()) { return false; } boolean modified = false; BooleanIterator iterator = source.booleanIterator(); while (iterator.hasNext()) { if (this.state == 0) { return modified; } boolean item = iterator.next(); if (this.remove(item)) { modified = true; } } return modified; }
public boolean containsAll(BooleanIterable source) { for (BooleanIterator iterator = source.booleanIterator(); iterator.hasNext(); ) { if (!this.contains(iterator.next())) { return false; } } return true; }
public boolean removeAll(BooleanIterable source) { boolean modified = false; for (int i = 0; i < this.size; i++) { if (source.contains(this.items.get(i))) { this.removeAtIndex(i); i--; modified = true; } } return modified; }
@Override @Test public void appendString() { StringBuilder appendable = new StringBuilder(); this.newWith().appendString(appendable); Assert.assertEquals("", appendable.toString()); this.newWith().appendString(appendable, "/"); Assert.assertEquals("", appendable.toString()); this.newWith().appendString(appendable, "[", "/", "]"); Assert.assertEquals("[]", appendable.toString()); StringBuilder appendable1 = new StringBuilder(); this.newWith(true).appendString(appendable1); Assert.assertEquals("true", appendable1.toString()); StringBuilder appendable2 = new StringBuilder(); BooleanIterable iterable = this.newWith(true, false); iterable.appendString(appendable2); Assert.assertTrue( "true, false".equals(appendable2.toString()) || "false, true".equals(appendable2.toString())); StringBuilder appendable3 = new StringBuilder(); iterable.appendString(appendable3, "/"); Assert.assertTrue( "true/false".equals(appendable3.toString()) || "false/true".equals(appendable3.toString())); }
public boolean addAll(BooleanIterable source) { return this.addAll(source.toArray()); }
private BooleanArrayList(BooleanIterable booleanIterable) { BooleanIterator booleanIterator = booleanIterable.booleanIterator(); while (booleanIterator.hasNext()) { this.add(booleanIterator.next()); } }
public BooleanArrayList withAll(BooleanIterable elements) { this.addAll(elements.toArray()); return this; }
public boolean addAllAtIndex(int index, BooleanIterable source) { return this.addAllAtIndex(index, source.toArray()); }