use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class BooleanHashBagTest method toList.
@Override
@Test
public void toList() {
super.toList();
MutableBooleanList list = this.newWith(true, true, true, false).toList();
Assert.assertEquals(list, BooleanArrayList.newListWith(false, true, true, true));
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class BooleanCaseProcedureTest method noopCaseAndThenDefault.
@Test
public void noopCaseAndThenDefault() {
MutableBooleanList result = BooleanLists.mutable.empty();
BooleanList source = BooleanLists.mutable.with(true, false);
BooleanCaseProcedure procedure = new BooleanCaseProcedure();
source.each(procedure);
Verify.assertEmpty(result);
procedure.setDefault(result::add);
source.each(procedure);
Assert.assertEquals(result, source);
Verify.assertContains("BooleanCaseProcedure", procedure.toString());
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class BooleanCaseProcedureTest method twoCasesWithDefault.
@Test
public void twoCasesWithDefault() {
MutableBooleanList ifOneList = BooleanLists.mutable.empty();
MutableBooleanList ifTwoList = BooleanLists.mutable.empty();
MutableBooleanList defaultList = BooleanLists.mutable.empty();
MutableBooleanList list = BooleanLists.mutable.with(true, true, false, false);
BooleanCaseProcedure procedure = new BooleanCaseProcedure(defaultList::add).addCase(value -> value, ifOneList::add).addCase(value -> !value, ifTwoList::add);
list.each(procedure);
Assert.assertEquals(BooleanLists.mutable.with(true, true), ifOneList);
Assert.assertEquals(BooleanLists.mutable.with(false, false), ifTwoList);
Assert.assertEquals(BooleanLists.mutable.empty(), defaultList);
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class SynchronizedBooleanListTest method asSynchronized.
@Override
@Test
public void asSynchronized() {
super.asSynchronized();
SynchronizedBooleanList list = this.classUnderTest();
MutableBooleanList listWithLockObject = new SynchronizedBooleanList(BooleanArrayList.newListWith(true, false, true), new Object()).asSynchronized();
Assert.assertEquals(list, listWithLockObject);
Assert.assertSame(listWithLockObject, listWithLockObject.asSynchronized());
Assert.assertSame(list, list.asSynchronized());
Assert.assertEquals(list, list.asSynchronized());
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method newWithout.
@Override
@Test
public void newWithout() {
ImmutableBooleanCollection trueCollection = this.getTrueCollection(this.classUnderTest()).toImmutable();
Assert.assertSame(trueCollection, trueCollection.newWithout(false));
Assert.assertNotSame(trueCollection, trueCollection.newWithout(true));
ImmutableBooleanCollection collection = this.classUnderTest();
MutableBooleanList list = collection.toList();
Assert.assertEquals(list.without(true), collection.newWithout(true));
MutableBooleanList list1 = collection.toList();
Assert.assertEquals(list1.without(false), collection.newWithout(false));
Assert.assertEquals(this.classUnderTest(), collection);
}
Aggregations