Search in sources :

Example 26 with BooleanArrayList

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;
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)

Example 27 with BooleanArrayList

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);
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Example 28 with BooleanArrayList

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());
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 29 with BooleanArrayList

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());
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 30 with BooleanArrayList

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());
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) ImmutableBooleanList(org.eclipse.collections.api.list.primitive.ImmutableBooleanList) Test(org.junit.Test)

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