use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class AbstractMutableSortedMap method collectBoolean.
@Override
public MutableBooleanList collectBoolean(BooleanFunction<? super V> booleanFunction) {
BooleanArrayList result = new BooleanArrayList(this.size());
this.forEach(new CollectBooleanProcedure<>(booleanFunction, result));
return result;
}
use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class AbstractBooleanSetTestCase method removeAll_iterable.
@Override
@Test
public void removeAll_iterable() {
super.removeAll_iterable();
Assert.assertFalse(this.emptySet.removeAll(new BooleanArrayList()));
Assert.assertFalse(this.setWithFalse.removeAll(new BooleanArrayList()));
Assert.assertFalse(this.setWithTrue.removeAll(new BooleanArrayList()));
Assert.assertFalse(this.setWithTrueFalse.removeAll(new BooleanArrayList()));
Assert.assertTrue(this.setWithTrueFalse.removeAll(BooleanArrayList.newListWith(true, true)));
Assert.assertEquals(BooleanHashSet.newSetWith(false), this.setWithTrueFalse);
MutableBooleanSet set = this.newWith(true, false);
Assert.assertTrue(set.removeAll(BooleanArrayList.newListWith(true, false)));
Assert.assertEquals(BooleanHashSet.newSetWith(), set);
MutableBooleanSet sett = this.newWith(true, false);
Assert.assertTrue(sett.removeAll(BooleanArrayList.newListWith(false, false)));
Assert.assertEquals(BooleanHashSet.newSetWith(true), sett);
Assert.assertFalse(this.setWithTrue.removeAll(BooleanArrayList.newListWith(false, false)));
MutableBooleanSet sett2 = this.newWith(true);
Assert.assertTrue(sett2.removeAll(BooleanArrayList.newListWith(true, true)));
Assert.assertEquals(BooleanHashSet.newSetWith(), sett2);
Assert.assertTrue(this.setWithTrue.removeAll(BooleanArrayList.newListWith(true, false)));
Assert.assertEquals(BooleanHashSet.newSetWith(), this.setWithTrue);
Assert.assertFalse(this.setWithFalse.removeAll(true, true));
MutableBooleanSet sett3 = this.newWith(false);
Assert.assertTrue(sett3.removeAll(BooleanArrayList.newListWith(false, false)));
Assert.assertEquals(BooleanHashSet.newSetWith(), sett3);
Assert.assertTrue(this.setWithFalse.removeAll(BooleanArrayList.newListWith(true, false)));
Assert.assertEquals(BooleanHashSet.newSetWith(), this.setWithFalse);
Assert.assertFalse(this.emptySet.removeAll(BooleanArrayList.newListWith(true, true)));
Assert.assertFalse(this.emptySet.removeAll(BooleanArrayList.newListWith(true, false)));
Assert.assertFalse(this.emptySet.removeAll(BooleanArrayList.newListWith(false, false)));
Assert.assertEquals(BooleanHashSet.newSetWith(), this.emptySet);
}
use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class AbstractBooleanStackTestCase method toList.
@Override
@Test
public void toList() {
super.toList();
BooleanArrayList list = new BooleanArrayList();
int size = this.classUnderTest().size();
for (int i = 0; i < size; i++) {
list.add((i & 1) != 0);
}
Assert.assertEquals(list, this.classUnderTest().toList());
}
use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanStackTestCase method toList.
@Override
@Test
public void toList() {
BooleanArrayList expected = BooleanArrayList.newListWith();
this.classUnderTest().forEach(expected::add);
Assert.assertEquals(expected, this.classUnderTest().toList());
}
use of org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList in project eclipse-collections by eclipse.
the class BooleanListsTest method newListWithList.
@Test
public void newListWithList() {
ImmutableBooleanList list = BooleanLists.immutable.of();
BooleanArrayList booleanArrayList = BooleanArrayList.newListWith(true);
Assert.assertEquals(list = list.newWith(true), booleanArrayList.toImmutable());
Assert.assertEquals(list = list.newWith(false), booleanArrayList.with(false).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(false), booleanArrayList.with(false).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(false), booleanArrayList.with(false).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(false), booleanArrayList.with(false).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
}
Aggregations