Search in sources :

Example 26 with MutableBooleanList

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

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

Example 27 with MutableBooleanList

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

the class ArrayIterateTest method collectBooleanWithTarget.

@Test
public void collectBooleanWithTarget() {
    Integer[] objectArray = { -1, 0, 42 };
    BooleanArrayList target = new BooleanArrayList();
    MutableBooleanList result = ArrayIterate.collectBoolean(objectArray, PrimitiveFunctions.integerIsPositive(), target);
    Assert.assertEquals(this.getExpectedBooleanResults(), result);
    Assert.assertSame("Target List not returned as result", target, result);
}
Also used : BigInteger(java.math.BigInteger) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 28 with MutableBooleanList

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

the class ArrayListIterateTest method collectBoolean.

@Test
public void collectBoolean() {
    ArrayList<Integer> list = this.createIntegerList();
    MutableBooleanList actual = ArrayListIterate.collectBoolean(list, PrimitiveFunctions.integerIsPositive());
    Assert.assertEquals(BooleanArrayList.newListWith(false, false, true), actual);
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Test(org.junit.Test)

Example 29 with MutableBooleanList

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

the class BooleanArrayStack method pop.

@Override
public BooleanList pop(int count) {
    this.checkPositiveValueForCount(count);
    this.checkSizeLessThanCount(count);
    if (count == 0) {
        return new BooleanArrayList(0);
    }
    MutableBooleanList subList = new BooleanArrayList(count);
    while (count > 0) {
        subList.add(this.pop());
        count--;
    }
    return subList;
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList)

Example 30 with MutableBooleanList

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

the class UnmodifiableBooleanListTest method removeAtIndex_throws_index_greater_than_size.

@Override
@Test(expected = UnsupportedOperationException.class)
public void removeAtIndex_throws_index_greater_than_size() {
    MutableBooleanList emptyList = new UnmodifiableBooleanList(new BooleanArrayList());
    emptyList.removeAtIndex(1);
}
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