use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection 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.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method retainAll_iterable.
@Test
public void retainAll_iterable() {
MutableBooleanCollection collection = this.classUnderTest();
Assert.assertFalse(collection.retainAll(true, false));
Assert.assertTrue(collection.retainAll(true));
Assert.assertEquals(this.newMutableCollectionWith(true, true), collection);
Assert.assertTrue(collection.retainAll(false, false));
Assert.assertEquals(this.newMutableCollectionWith(), collection);
MutableBooleanCollection list = this.classUnderTest();
Assert.assertFalse(list.retainAll(false, false, true));
MutableBooleanCollection booleanArrayList = this.newWith(false, false);
Assert.assertFalse(booleanArrayList.retainAll(false));
Assert.assertEquals(this.newMutableCollectionWith(false, false), booleanArrayList);
Assert.assertTrue(booleanArrayList.retainAll(true));
Assert.assertEquals(this.newMutableCollectionWith(), booleanArrayList);
Assert.assertTrue(list.retainAll(false));
Assert.assertEquals(this.newMutableCollectionWith(false), list);
Assert.assertTrue(list.retainAll());
Assert.assertEquals(this.newMutableCollectionWith(), list);
Assert.assertFalse(list.retainAll(true, false));
Assert.assertEquals(this.newMutableCollectionWith(), list);
MutableBooleanCollection list1 = this.newWith(true, false, true, true);
Assert.assertFalse(list1.retainAll(false, false, true));
Assert.assertTrue(list1.retainAll(false, false));
Verify.assertSize(1, list1);
Assert.assertFalse(list1.contains(true));
Assert.assertEquals(this.newMutableCollectionWith(false), list1);
Assert.assertTrue(list1.retainAll(true, true));
Assert.assertEquals(this.newMutableCollectionWith(), list1);
MutableBooleanCollection list2 = this.newWith(true, false, true, false, true);
Assert.assertTrue(list2.retainAll());
Assert.assertEquals(this.newMutableCollectionWith(), list2);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method iterator_throws_on_consecutive_invocation_of_remove.
@Test
public void iterator_throws_on_consecutive_invocation_of_remove() {
MutableBooleanCollection booleanIterable = this.newWith(true, false);
MutableBooleanIterator iterator = booleanIterable.booleanIterator();
iterator.next();
iterator.remove();
Verify.assertThrows(IllegalStateException.class, iterator::remove);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method withoutAll.
@Test
public void withoutAll() {
MutableBooleanCollection mainCollection = this.newWith(true, false, true, false, true);
Assert.assertEquals(this.newMutableCollectionWith(true, true, true), mainCollection.withoutAll(this.newMutableCollectionWith(false, false)));
MutableBooleanCollection collection = this.newWith(true, false, true, false, true);
Assert.assertEquals(this.newMutableCollectionWith(true, true, true), collection.withoutAll(BooleanHashBag.newBagWith(false)));
Assert.assertEquals(this.newMutableCollectionWith(), collection.withoutAll(BooleanHashBag.newBagWith(true, false)));
Assert.assertEquals(this.newMutableCollectionWith(), collection.withoutAll(BooleanHashBag.newBagWith(true, false)));
MutableBooleanCollection trueCollection = this.newWith(true, true, true);
Assert.assertEquals(this.newMutableCollectionWith(true, true, true), trueCollection.withoutAll(BooleanArrayList.newListWith(false)));
MutableBooleanCollection mutableBooleanCollection = trueCollection.withoutAll(BooleanArrayList.newListWith(true));
Assert.assertEquals(this.newMutableCollectionWith(), mutableBooleanCollection);
Assert.assertSame(trueCollection, mutableBooleanCollection);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method with.
@Test
public void with() {
MutableBooleanCollection emptyCollection = this.newWith();
MutableBooleanCollection collection = emptyCollection.with(true);
MutableBooleanCollection collection0 = this.newWith().with(true).with(false);
MutableBooleanCollection collection1 = this.newWith().with(true).with(false).with(true);
MutableBooleanCollection collection2 = this.newWith().with(true).with(false).with(true).with(false);
MutableBooleanCollection collection3 = this.newWith().with(true).with(false).with(true).with(false).with(true);
Assert.assertSame(emptyCollection, collection);
Assert.assertEquals(this.newMutableCollectionWith(true), collection);
Assert.assertEquals(this.newMutableCollectionWith(true, false), collection0);
Assert.assertEquals(this.newMutableCollectionWith(true, false, true), collection1);
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false), collection2);
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false, true), collection3);
}
Aggregations