Search in sources :

Example 31 with MutableBooleanList

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

the class AbstractListTestCase method collectBoolean.

@Override
public void collectBoolean() {
    super.collectBoolean();
    MutableBooleanList result = this.newWith(-1, 0, 1, 4).collectBoolean(PrimitiveFunctions.integerIsPositive());
    Assert.assertEquals(BooleanLists.mutable.of(false, false, true, true), result);
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList)

Example 32 with MutableBooleanList

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

the class AbstractBooleanListTestCase method indexOf.

@Test
public void indexOf() {
    MutableBooleanList arrayList = this.newWith(true, false, true);
    Assert.assertEquals(0L, arrayList.indexOf(true));
    Assert.assertEquals(1L, arrayList.indexOf(false));
    Assert.assertEquals(-1L, this.newWith(false, false).indexOf(true));
    MutableBooleanList emptyList = this.newWith();
    Assert.assertEquals(-1L, emptyList.indexOf(true));
    Assert.assertEquals(-1L, emptyList.indexOf(false));
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 33 with MutableBooleanList

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

the class AbstractBooleanListTestCase method get.

@Test
public void get() {
    MutableBooleanList list = this.classUnderTest();
    Assert.assertTrue(list.get(0));
    Assert.assertFalse(list.get(1));
    Assert.assertTrue(list.get(2));
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 34 with MutableBooleanList

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

the class AbstractBooleanListTestCase method addAtIndex.

@Test
public void addAtIndex() {
    MutableBooleanList emptyList = this.newWith();
    emptyList.addAtIndex(0, false);
    Assert.assertEquals(BooleanArrayList.newListWith(false), emptyList);
    MutableBooleanList list = this.classUnderTest();
    list.addAtIndex(3, true);
    Assert.assertEquals(BooleanArrayList.newListWith(true, false, true, true), list);
    list.addAtIndex(2, false);
    Assert.assertEquals(BooleanArrayList.newListWith(true, false, false, true, true), list);
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 35 with MutableBooleanList

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

the class AbstractBooleanListTestCase method getFirst.

@Test
public void getFirst() {
    MutableBooleanList singleItemList = this.newWith(true);
    Assert.assertTrue(singleItemList.getFirst());
    Assert.assertTrue(this.classUnderTest().getFirst());
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Aggregations

MutableBooleanList (org.eclipse.collections.api.list.primitive.MutableBooleanList)44 Test (org.junit.Test)38 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)6 ImmutableBooleanCollection (org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection)4 BooleanIterator (org.eclipse.collections.api.iterator.BooleanIterator)3 BooleanList (org.eclipse.collections.api.list.primitive.BooleanList)3 ImmutableBooleanList (org.eclipse.collections.api.list.primitive.ImmutableBooleanList)3 Verify (org.eclipse.collections.impl.test.Verify)3 Assert (org.junit.Assert)3 ArrayList (java.util.ArrayList)2 BooleanIterable (org.eclipse.collections.api.BooleanIterable)2 LazyBooleanIterable (org.eclipse.collections.api.LazyBooleanIterable)2 BooleanLists (org.eclipse.collections.impl.factory.primitive.BooleanLists)2 ReverseBooleanIterable (org.eclipse.collections.impl.lazy.primitive.ReverseBooleanIterable)2 ByteArrayList (org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList)2 CharArrayList (org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)2 DoubleArrayList (org.eclipse.collections.impl.list.mutable.primitive.DoubleArrayList)2 FloatArrayList (org.eclipse.collections.impl.list.mutable.primitive.FloatArrayList)2 IntArrayList (org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)2 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)2