use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class ImmutableBooleanEmptyListTest method reject.
@Override
@Test
public void reject() {
super.reject();
BooleanIterable iterable = this.classUnderTest();
Verify.assertEmpty(iterable.reject(BooleanPredicates.isTrue()));
BooleanIterable booleanIterable = iterable.reject(BooleanPredicates.isFalse());
Verify.assertEmpty(booleanIterable);
Assert.assertSame(iterable, booleanIterable);
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class ObjectBooleanHashMap method chunk.
@Override
public RichIterable<BooleanIterable> chunk(int size) {
if (size <= 0) {
throw new IllegalArgumentException("Size for groups must be positive but was: " + size);
}
MutableList<BooleanIterable> result = Lists.mutable.empty();
if (this.notEmpty()) {
BooleanIterator iterator = this.booleanIterator();
while (iterator.hasNext()) {
MutableBooleanBag batch = BooleanBags.mutable.empty();
for (int i = 0; i < size && iterator.hasNext(); i++) {
batch.add(iterator.next());
}
result.add(batch);
}
}
return result;
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class CollectBooleanIterableTest method containsAllIterable.
@Test
public void containsAllIterable() {
BooleanIterable booleanIterable = Interval.oneTo(3).collectBoolean(PrimitiveFunctions.integerIsPositive());
Assert.assertTrue(booleanIterable.containsAll(BooleanArrayList.newListWith(true)));
Assert.assertTrue(booleanIterable.containsAll(BooleanArrayList.newListWith(true, true)));
Assert.assertFalse(booleanIterable.containsAll(BooleanArrayList.newListWith(false)));
Assert.assertFalse(booleanIterable.containsAll(BooleanArrayList.newListWith(false, false)));
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class ReverseBooleanIterableTest method iterator_throws.
@Test(expected = NoSuchElementException.class)
public void iterator_throws() {
BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
BooleanIterator iterator = iterable.booleanIterator();
while (iterator.hasNext()) {
iterator.next();
}
iterator.next();
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class ReverseBooleanIterableTest method reject.
@Test
public void reject() {
BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
Verify.assertSize(1, iterable.reject(BooleanPredicates.equal(false)));
Verify.assertSize(2, iterable.reject(BooleanPredicates.equal(true)));
}
Aggregations