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);
}
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));
}
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);
}
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);
}
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;
}
Aggregations