Search in sources :

Example 36 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.

the class ReverseBooleanIterableTest method isEmpty.

@Test
public void isEmpty() {
    BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
    Verify.assertEmpty(new BooleanArrayList().asReversed());
    Verify.assertNotEmpty(iterable);
}
Also used : BooleanIterable(org.eclipse.collections.api.BooleanIterable) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 37 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanListTestCase method newWithOn64ElementCollection.

@Test
public void newWithOn64ElementCollection() {
    BooleanArrayList sixtyFourElementCollection = new BooleanArrayList();
    for (int i = 0; i < 64; i++) {
        sixtyFourElementCollection.add(true);
    }
    ImmutableBooleanList immutableBooleanList = sixtyFourElementCollection.toImmutable();
    Assert.assertEquals(sixtyFourElementCollection, immutableBooleanList);
    ImmutableBooleanList newImmutableBooleanList = immutableBooleanList.newWith(false);
    Assert.assertFalse(newImmutableBooleanList.get(64));
    ImmutableBooleanList newImmutableBooleanList1 = immutableBooleanList.newWith(true);
    Assert.assertTrue(newImmutableBooleanList1.get(64));
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) ImmutableBooleanList(org.eclipse.collections.api.list.primitive.ImmutableBooleanList) Test(org.junit.Test)

Example 38 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.

the class AbstractMutableBooleanBagTestCase method addAllIterable.

@Override
@Test
public void addAllIterable() {
    super.addAllIterable();
    MutableBooleanBag bag = this.newWith();
    Assert.assertTrue(bag.addAll(BooleanArrayList.newListWith(true, false, true, false, true)));
    Assert.assertFalse(bag.addAll(new BooleanArrayList()));
    Assert.assertEquals(BooleanHashBag.newBagWith(true, false, true, false, true), bag);
    Assert.assertTrue(bag.addAll(BooleanHashBag.newBagWith(true, false, true, false, true)));
    Assert.assertEquals(BooleanHashBag.newBagWith(false, false, false, false, true, true, true, true, true, true), bag);
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanBag(org.eclipse.collections.api.bag.primitive.MutableBooleanBag) Test(org.junit.Test)

Example 39 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList 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 40 with BooleanArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList 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)

Aggregations

BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)49 Test (org.junit.Test)35 MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)11 BooleanIterable (org.eclipse.collections.api.BooleanIterable)7 MutableBooleanList (org.eclipse.collections.api.list.primitive.MutableBooleanList)6 MutableBooleanSet (org.eclipse.collections.api.set.primitive.MutableBooleanSet)3 BooleanHashBag (org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag)3 ByteArrayList (org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList)3 CharArrayList (org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)3 DoubleArrayList (org.eclipse.collections.impl.list.mutable.primitive.DoubleArrayList)3 FloatArrayList (org.eclipse.collections.impl.list.mutable.primitive.FloatArrayList)3 IntArrayList (org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)3 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)3 ShortArrayList (org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList)3 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 Comparator (java.util.Comparator)2 NoSuchElementException (java.util.NoSuchElementException)2 ImmutableSortedBag (org.eclipse.collections.api.bag.sorted.ImmutableSortedBag)2 MutableCollection (org.eclipse.collections.api.collection.MutableCollection)2