use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method chunk.
@Test
public void chunk() {
BooleanIterable iterable1 = this.newWith(true);
Verify.assertIterablesEqual(Lists.mutable.with(this.newMutableCollectionWith(true)).toSet(), iterable1.chunk(1).toSet());
BooleanIterable iterable2 = this.newWith(false);
Verify.assertIterablesEqual(Lists.mutable.with(this.newMutableCollectionWith(false)).toSet(), iterable2.chunk(1).toSet());
BooleanIterable iterable3 = this.newWith(false, true);
Verify.assertIterablesEqual(Lists.mutable.with(this.newMutableCollectionWith(false), this.newMutableCollectionWith(true)).toSet(), iterable3.chunk(1).toSet());
Verify.assertIterablesEqual(Lists.mutable.with(this.newMutableCollectionWith(false, true)), iterable3.chunk(2));
Verify.assertIterablesEqual(Lists.mutable.with(this.newMutableCollectionWith(false, true)), iterable3.chunk(3));
Verify.assertThrows(IllegalArgumentException.class, () -> this.classUnderTest().chunk(0));
Verify.assertThrows(IllegalArgumentException.class, () -> this.classUnderTest().chunk(-1));
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class CollectBooleanIterableTest method containsAllArray.
@Test
public void containsAllArray() {
BooleanIterable booleanIterable = Interval.oneTo(3).collectBoolean(PrimitiveFunctions.integerIsPositive());
Assert.assertTrue(booleanIterable.containsAll(true));
Assert.assertTrue(booleanIterable.containsAll(true, true));
Assert.assertFalse(booleanIterable.containsAll(false));
Assert.assertFalse(booleanIterable.containsAll(false, false));
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class ReverseBooleanIterableTest method detectIfNone.
@Test
public void detectIfNone() {
BooleanIterable iterable = BooleanArrayList.newListWith(false, false).asReversed();
Assert.assertFalse(iterable.detectIfNone(BooleanPredicates.equal(false), true));
Assert.assertTrue(iterable.detectIfNone(BooleanPredicates.equal(true), true));
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class ReverseBooleanIterableTest method toArray.
@Test
public void toArray() {
BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
Assert.assertTrue(iterable.toArray()[0]);
Assert.assertFalse(iterable.toArray()[1]);
Assert.assertFalse(iterable.toArray()[2]);
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class ReverseBooleanIterableTest method collect.
@Test
public void collect() {
BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
Verify.assertIterablesEqual(FastList.newListWith(false, true, true), iterable.collect(parameter -> !parameter));
}
Aggregations