use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method removeAll.
@Test
public void removeAll() {
Assert.assertFalse(this.newWith().removeAll(true));
MutableBooleanCollection collection = this.classUnderTest();
Assert.assertFalse(collection.removeAll());
Assert.assertTrue(collection.removeAll(true));
Assert.assertEquals(this.newMutableCollectionWith(false), collection);
Assert.assertFalse(collection.removeAll(true));
Assert.assertEquals(this.newMutableCollectionWith(false), collection);
Assert.assertTrue(collection.removeAll(false, true));
Assert.assertEquals(this.newMutableCollectionWith(), collection);
MutableBooleanCollection booleanArrayCollection = this.newWith(false, false);
Assert.assertFalse(booleanArrayCollection.removeAll(true));
Assert.assertEquals(this.newMutableCollectionWith(false, false), booleanArrayCollection);
Assert.assertTrue(booleanArrayCollection.removeAll(false));
Assert.assertEquals(this.newMutableCollectionWith(), booleanArrayCollection);
MutableBooleanCollection collection1 = this.classUnderTest();
Assert.assertFalse(collection1.removeAll());
Assert.assertTrue(collection1.removeAll(true, false));
Assert.assertEquals(this.newMutableCollectionWith(), collection1);
MutableBooleanCollection trueFalseList = this.newWith(true, false);
Assert.assertTrue(trueFalseList.removeAll(true));
Assert.assertEquals(this.newMutableCollectionWith(false), trueFalseList);
MutableBooleanCollection collection2 = this.newWith(true, false, true, false, true);
Assert.assertFalse(collection2.removeAll());
Assert.assertTrue(collection2.removeAll(true, true));
Assert.assertEquals(this.newMutableCollectionWith(false, false), collection2);
MutableBooleanCollection collection3 = this.newWith(true, false, true, false, true);
Assert.assertFalse(collection3.removeAll());
Assert.assertTrue(collection3.removeAll(true, false));
Assert.assertEquals(this.newMutableCollectionWith(), collection3);
MutableBooleanCollection collection4 = this.newWith(true, false, true, false, true);
Assert.assertFalse(collection4.removeAll());
Assert.assertTrue(collection4.removeAll(false, false));
Assert.assertEquals(this.newMutableCollectionWith(true, true, true), collection4);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method add.
@Test
public void add() {
MutableBooleanCollection emptyCollection = this.newWith();
Assert.assertTrue(emptyCollection.add(true));
Assert.assertEquals(this.newMutableCollectionWith(true), emptyCollection);
Assert.assertTrue(emptyCollection.add(false));
Assert.assertEquals(this.newMutableCollectionWith(true, false), emptyCollection);
Assert.assertTrue(emptyCollection.add(true));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true), emptyCollection);
Assert.assertTrue(emptyCollection.add(false));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false), emptyCollection);
MutableBooleanCollection collection = this.classUnderTest();
Assert.assertTrue(collection.add(false));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false), collection);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractLazyIterableTestCase method collectBooleanWithTarget.
@Test
public void collectBooleanWithTarget() {
MutableBooleanCollection target = new BooleanArrayList();
MutableBooleanCollection result = this.lazyIterable.collectBoolean(PrimitiveFunctions.integerIsPositive(), target);
Assert.assertEquals(BooleanArrayList.newListWith(true, true, true, true, true, true, true), result.toList());
Assert.assertSame("Target list sent as parameter not returned", target, result);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectBooleanWithTarget.
@Test
public void collectBooleanWithTarget() {
MutableBooleanCollection target = new BooleanArrayList();
BooleanIterable result = this.newWith(1, 0).collectBoolean(PrimitiveFunctions.integerIsPositive(), target);
Assert.assertSame("Target list sent as parameter not returned", target, result);
Assert.assertEquals(BooleanBags.mutable.of(true, false), result.toBag());
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class IterateTest method collectBooleanWithTarget.
@Test
public void collectBooleanWithTarget() {
this.iterables.each(each -> {
MutableBooleanCollection expected = new BooleanArrayList();
MutableBooleanCollection actual = Iterate.collectBoolean(each, PrimitiveFunctions.integerIsPositive(), expected);
Assert.assertTrue(expected.containsAll(true, true, true, true, true));
Assert.assertSame("Target list sent as parameter not returned", expected, actual);
});
Verify.assertThrows(IllegalArgumentException.class, () -> Iterate.collectBoolean(null, PrimitiveFunctions.integerIsPositive(), new BooleanArrayList()));
}
Aggregations