use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method newWithAll.
@Override
@Test
public void newWithAll() {
ImmutableBooleanCollection booleanCollection = this.classUnderTest();
MutableBooleanList list = booleanCollection.toList();
ImmutableBooleanCollection collection = booleanCollection.newWithAll(this.newMutableCollectionWith(true));
ImmutableBooleanCollection collection0 = booleanCollection.newWithAll(this.newMutableCollectionWith(true, false));
ImmutableBooleanCollection collection1 = booleanCollection.newWithAll(this.newMutableCollectionWith(true, false, true));
ImmutableBooleanCollection collection2 = booleanCollection.newWithAll(this.newMutableCollectionWith(true, false, true, false));
ImmutableBooleanCollection collection3 = booleanCollection.newWithAll(this.newMutableCollectionWith(true, false, true, false, true));
ImmutableBooleanCollection collection4 = collection3.newWithAll(this.newMutableCollectionWith(true, false, true, false, 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 newWithoutAll.
@Override
@Test
public void newWithoutAll() {
ImmutableBooleanCollection immutableBooleanCollection = this.classUnderTest();
MutableBooleanCollection mutableTrueCollection = this.getTrueCollection(immutableBooleanCollection);
ImmutableBooleanCollection trueCollection = mutableTrueCollection.toImmutable();
Assert.assertEquals(this.newMutableCollectionWith(), trueCollection.newWithoutAll(this.newMutableCollectionWith(true, false)));
Assert.assertEquals(mutableTrueCollection, trueCollection);
MutableBooleanList list = immutableBooleanCollection.toList();
list.removeAll(true);
Assert.assertEquals(list, immutableBooleanCollection.newWithoutAll(this.newMutableCollectionWith(true)));
Assert.assertEquals(this.newMutableCollectionWith(), immutableBooleanCollection.newWithoutAll(this.newMutableCollectionWith(true, false)));
ImmutableBooleanCollection collection = this.newWith(true, false, true, false, true);
Assert.assertEquals(this.newMutableCollectionWith(false, false), collection.newWithoutAll(this.newMutableCollectionWith(true, true)));
Assert.assertEquals(this.newMutableCollectionWith(), collection.newWithoutAll(this.newMutableCollectionWith(true, false)));
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method lastIndexOf.
@Test
public void lastIndexOf() {
ImmutableBooleanList list = this.classUnderTest();
int size = list.size();
Assert.assertEquals((size & 1) == 0 ? size - 2 : size - 1, list.lastIndexOf(true));
Assert.assertEquals((size & 1) == 0 ? size - 1 : size - 2, list.lastIndexOf(false));
MutableBooleanList mutableList = this.newMutableCollectionWith();
for (int i = 0; i < list.size(); i++) {
mutableList.add(false);
}
Assert.assertEquals(-1L, mutableList.toImmutable().lastIndexOf(true));
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method indexOf.
@Test
public void indexOf() {
ImmutableBooleanList list = this.classUnderTest();
Assert.assertEquals(0L, list.indexOf(true));
Assert.assertEquals(list.size() > 2 ? 1L : -1L, list.indexOf(false));
MutableBooleanList mutableList = this.newMutableCollectionWith();
for (int i = 0; i < list.size(); i++) {
mutableList.add(false);
}
Assert.assertEquals(-1L, mutableList.toImmutable().indexOf(true));
}
use of org.eclipse.collections.api.list.primitive.MutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanBagTestCase method toList.
@Override
@Test
public void toList() {
super.toList();
MutableBooleanList list = this.newWith(false, false, true).toList();
Assert.assertTrue(list.equals(BooleanArrayList.newListWith(false, false, true)) || list.equals(BooleanArrayList.newListWith(true, false, false)) || list.equals(BooleanArrayList.newListWith(false, true, false)));
}
Aggregations