use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method testNewWith.
@Override
@Test
public void testNewWith() {
ImmutableBooleanCollection booleanCollection = this.classUnderTest();
MutableBooleanList list = booleanCollection.toList();
ImmutableBooleanCollection collection = booleanCollection.newWith(true);
ImmutableBooleanCollection collection0 = booleanCollection.newWith(true).newWith(false);
ImmutableBooleanCollection collection1 = booleanCollection.newWith(true).newWith(false).newWith(true);
ImmutableBooleanCollection collection2 = booleanCollection.newWith(true).newWith(false).newWith(true).newWith(false);
ImmutableBooleanCollection collection3 = booleanCollection.newWith(true).newWith(false).newWith(true).newWith(false).newWith(true);
ImmutableBooleanCollection collection4 = collection3.newWith(true).newWith(false).newWith(true).newWith(false).newWith(true);
Assert.assertEquals(list, booleanCollection);
Assert.assertEquals(list.with(true), collection);
Assert.assertEquals(list.with(false), collection0);
Assert.assertEquals(list.with(true), collection1);
Assert.assertEquals(list.with(false), collection2);
Assert.assertEquals(list.with(true), collection3);
list.addAll(true, false, true, false, true);
Assert.assertEquals(list, collection4);
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method toList.
@Override
@Test
public void toList() {
super.toList();
MutableBooleanList list = this.classUnderTest().toList();
Verify.assertEqualsAndHashCode(this.classUnderTest(), list);
Assert.assertNotSame(this.classUnderTest(), list);
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractBooleanListTestCase method removeAtIndex.
@Test
public void removeAtIndex() {
MutableBooleanList list = this.classUnderTest();
list.removeAtIndex(1);
Assert.assertEquals(BooleanArrayList.newListWith(true, true), list);
list.removeAtIndex(1);
Assert.assertEquals(BooleanArrayList.newListWith(true), list);
list.removeAtIndex(0);
Assert.assertEquals(BooleanArrayList.newListWith(), list);
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractBooleanListTestCase method removeIf.
@Test
public void removeIf() {
Assert.assertFalse(this.newWith(true, true).removeIf(b -> !b));
MutableBooleanList list = this.classUnderTest();
Assert.assertTrue(list.removeIf(b -> b));
Assert.assertEquals(BooleanArrayList.newListWith(false), list);
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractBooleanListTestCase method lastIndexOf.
@Test
public void lastIndexOf() {
MutableBooleanList list = this.newWith(true, false, true);
Assert.assertEquals(2L, list.lastIndexOf(true));
Assert.assertEquals(1L, list.lastIndexOf(false));
Assert.assertEquals(-1L, this.newWith(false, false).lastIndexOf(true));
MutableBooleanList emptyList = this.newWith();
Assert.assertEquals(-1L, emptyList.lastIndexOf(true));
Assert.assertEquals(-1L, emptyList.lastIndexOf(false));
}
Aggregations