Search in sources :

Example 11 with ImmutableBooleanList

use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList 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));
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) ImmutableBooleanList(org.eclipse.collections.api.list.primitive.ImmutableBooleanList) Test(org.junit.Test)

Example 12 with ImmutableBooleanList

use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.

the class ImmutableBooleanEmptyListTest method newWithout.

@Override
@Test
public void newWithout() {
    ImmutableBooleanList emptyList = this.newWith();
    ImmutableBooleanList newList = emptyList.newWithout(true);
    Assert.assertEquals(this.newWith(), newList);
    Assert.assertSame(emptyList, newList);
    Assert.assertEquals(this.newMutableCollectionWith(), emptyList);
}
Also used : ImmutableBooleanList(org.eclipse.collections.api.list.primitive.ImmutableBooleanList) Test(org.junit.Test)

Example 13 with ImmutableBooleanList

use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.

the class AbstractBooleanListTestCase method toImmutable.

@Test
public void toImmutable() {
    ImmutableBooleanList immutable = this.classUnderTest().toImmutable();
    Assert.assertEquals(BooleanArrayList.newListWith(true, false, true), immutable);
}
Also used : ImmutableBooleanList(org.eclipse.collections.api.list.primitive.ImmutableBooleanList) Test(org.junit.Test)

Aggregations

ImmutableBooleanList (org.eclipse.collections.api.list.primitive.ImmutableBooleanList)13 Test (org.junit.Test)13 MutableBooleanList (org.eclipse.collections.api.list.primitive.MutableBooleanList)2 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)2 MutableInteger (org.eclipse.collections.impl.math.MutableInteger)1