Search in sources :

Example 36 with MutableBooleanList

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

the class AbstractBooleanListTestCase method toReversed.

@Test
public void toReversed() {
    Assert.assertEquals(BooleanArrayList.newListWith(true, true, false, false), this.newWith(false, false, true, true).toReversed());
    MutableBooleanList originalList = this.newWith(true, true, false, false);
    Assert.assertNotSame(originalList, originalList.toReversed());
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 37 with MutableBooleanList

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

the class AbstractBooleanListTestCase method injectIntoWithIndex.

@Test
public void injectIntoWithIndex() {
    MutableBooleanList list = this.newWith(true, false, true);
    MutableInteger result = list.injectIntoWithIndex(new MutableInteger(0), (object, value, index) -> object.add((value ? 1 : 0) + index));
    Assert.assertEquals(new MutableInteger(5), result);
}
Also used : MutableInteger(org.eclipse.collections.impl.math.MutableInteger) MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 38 with MutableBooleanList

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

the class AbstractBooleanListTestCase method remove.

@Override
@Test
public void remove() {
    super.remove();
    Assert.assertFalse(this.newWith(true, true).remove(false));
    MutableBooleanList list = this.classUnderTest();
    Assert.assertTrue(list.remove(true));
    Assert.assertEquals(BooleanArrayList.newListWith(false, true), list);
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 39 with MutableBooleanList

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

the class AbstractBooleanListTestCase method addAllArray.

@Override
@Test
public void addAllArray() {
    super.addAllArray();
    MutableBooleanList list = this.classUnderTest();
    Assert.assertFalse(list.addAllAtIndex(1));
    Assert.assertTrue(list.addAll(false, true, false));
    Assert.assertTrue(list.addAllAtIndex(4, true, true));
    Assert.assertEquals(BooleanArrayList.newListWith(true, false, true, false, true, true, true, false), list);
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 40 with MutableBooleanList

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

the class AbstractBooleanListTestCase method addAllIterable.

@Override
@Test
public void addAllIterable() {
    super.addAllIterable();
    MutableBooleanList list = this.classUnderTest();
    Assert.assertFalse(list.addAllAtIndex(1, new BooleanArrayList()));
    Assert.assertTrue(list.addAll(BooleanArrayList.newListWith(false, true, false)));
    Assert.assertTrue(list.addAllAtIndex(4, BooleanArrayList.newListWith(true, true)));
    Assert.assertEquals(BooleanArrayList.newListWith(true, false, true, false, true, true, true, false), list);
}
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