use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method retainAll.
@Test
public void retainAll() {
MutableBooleanCollection collection = this.classUnderTest();
Assert.assertFalse(collection.retainAll(this.newMutableCollectionWith(true, false)));
Assert.assertTrue(collection.retainAll(this.newMutableCollectionWith(true)));
Assert.assertEquals(this.newMutableCollectionWith(true, true), collection);
Assert.assertTrue(collection.retainAll(this.newMutableCollectionWith(false, false)));
Assert.assertEquals(this.newMutableCollectionWith(), collection);
MutableBooleanCollection list = this.classUnderTest();
Assert.assertFalse(list.retainAll(BooleanArrayList.newListWith(false, false, true)));
MutableBooleanCollection booleanArrayList = this.newWith(false, false);
Assert.assertFalse(booleanArrayList.retainAll(new BooleanArrayList(false)));
Assert.assertEquals(this.newMutableCollectionWith(false, false), booleanArrayList);
Assert.assertTrue(booleanArrayList.retainAll(new BooleanArrayList(true)));
Assert.assertEquals(this.newMutableCollectionWith(), booleanArrayList);
Assert.assertTrue(list.retainAll(new BooleanArrayList(false)));
Assert.assertEquals(this.newMutableCollectionWith(false), list);
Assert.assertTrue(list.retainAll(new BooleanArrayList()));
Assert.assertEquals(this.newMutableCollectionWith(), list);
Assert.assertFalse(list.retainAll(BooleanArrayList.newListWith(true, false)));
Assert.assertEquals(this.newMutableCollectionWith(), list);
MutableBooleanCollection list1 = this.newWith(true, false, true, true);
Assert.assertFalse(list1.retainAll(BooleanArrayList.newListWith(false, false, true)));
Assert.assertTrue(list1.retainAll(BooleanArrayList.newListWith(false, false)));
Verify.assertSize(1, list1);
Assert.assertFalse(list1.contains(true));
Assert.assertEquals(this.newMutableCollectionWith(false), list1);
Assert.assertTrue(list1.retainAll(BooleanArrayList.newListWith(true, true)));
Assert.assertEquals(this.newMutableCollectionWith(), list1);
MutableBooleanCollection list2 = this.newWith(true, false, true, false, true);
Assert.assertTrue(list2.retainAll(new BooleanHashBag()));
Assert.assertEquals(this.newMutableCollectionWith(), list2);
}
use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method addAllIterable.
@Test
public void addAllIterable() {
MutableBooleanCollection collection = this.classUnderTest();
Assert.assertFalse(collection.addAll(this.newMutableCollectionWith()));
Assert.assertTrue(collection.addAll(this.newMutableCollectionWith(false, true, false)));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false, true, false), collection);
Assert.assertTrue(collection.addAll(this.newMutableCollectionWith(true, false, true, false, true)));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false, true, false, true, false, true, false, true), collection);
MutableBooleanCollection emptyCollection = this.newWith();
Assert.assertTrue(emptyCollection.addAll(BooleanArrayList.newListWith(true, false, true, false, true)));
Assert.assertFalse(emptyCollection.addAll(new BooleanArrayList()));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false, true), emptyCollection);
}
use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class AbstractBooleanIterableTestCase method booleanIterator.
@Test
public void booleanIterator() {
BooleanArrayList list = BooleanArrayList.newListWith(true, false, true);
BooleanIterator iterator = this.classUnderTest().booleanIterator();
for (int i = 0; i < 3; i++) {
Assert.assertTrue(iterator.hasNext());
Assert.assertTrue(list.remove(iterator.next()));
}
Verify.assertEmpty(list);
Assert.assertFalse(iterator.hasNext());
}
use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class ImmutableEmptySortedBagTest method collectBoolean_target.
@Override
@Test
public void collectBoolean_target() {
ImmutableSortedBag<Integer> bag = this.classUnderTest();
Assert.assertEquals(new BooleanArrayList(), bag.collectBoolean(each -> false, new BooleanArrayList()));
ImmutableSortedBag<Integer> bag2 = this.classUnderTest();
Assert.assertEquals(new BooleanHashBag(), bag2.collectBoolean(each -> false, new BooleanHashBag()));
}
Aggregations