Search in sources :

Example 16 with BooleanArrayList

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

the class ImmutableBooleanHashSetTest method toList.

@Override
@Test
public void toList() {
    super.toList();
    Assert.assertEquals(new BooleanArrayList(), this.emptySet.toList());
    Assert.assertEquals(BooleanArrayList.newListWith(false), this.falseSet.toList());
    Assert.assertEquals(BooleanArrayList.newListWith(true), this.trueSet.toList());
    Assert.assertTrue(BooleanArrayList.newListWith(false, true).equals(this.trueFalseSet.toList()) || BooleanArrayList.newListWith(true, false).equals(this.trueFalseSet.toList()));
}
Also used : BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 17 with BooleanArrayList

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

the class ImmutableEmptySortedBagTest method collectBoolean.

@Override
@Test
public void collectBoolean() {
    ImmutableSortedBag<Integer> bag = this.classUnderTest();
    Assert.assertEquals(new BooleanArrayList(), bag.collectBoolean(each -> false));
}
Also used : Maps(org.eclipse.collections.impl.factory.Maps) CharHashBag(org.eclipse.collections.impl.bag.mutable.primitive.CharHashBag) SortedBags(org.eclipse.collections.impl.factory.SortedBags) ObjectIntPair(org.eclipse.collections.api.tuple.primitive.ObjectIntPair) Verify(org.eclipse.collections.impl.test.Verify) MutableList(org.eclipse.collections.api.list.MutableList) MutableSortedMap(org.eclipse.collections.api.map.sorted.MutableSortedMap) ImmutableSortedSet(org.eclipse.collections.api.set.sorted.ImmutableSortedSet) DoubleArrayList(org.eclipse.collections.impl.list.mutable.primitive.DoubleArrayList) HashBag(org.eclipse.collections.impl.bag.mutable.HashBag) Functions(org.eclipse.collections.impl.block.factory.Functions) ShortArrayList(org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList) ShortHashBag(org.eclipse.collections.impl.bag.mutable.primitive.ShortHashBag) Comparators(org.eclipse.collections.impl.block.factory.Comparators) SortedMaps(org.eclipse.collections.impl.factory.SortedMaps) DoubleHashBag(org.eclipse.collections.impl.bag.mutable.primitive.DoubleHashBag) IntArrayList(org.eclipse.collections.impl.list.mutable.primitive.IntArrayList) UnifiedMap(org.eclipse.collections.impl.map.mutable.UnifiedMap) ByteArrayList(org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList) ByteHashBag(org.eclipse.collections.impl.bag.mutable.primitive.ByteHashBag) CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList) BooleanHashBag(org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag) FloatArrayList(org.eclipse.collections.impl.list.mutable.primitive.FloatArrayList) MutableSortedSet(org.eclipse.collections.api.set.sorted.MutableSortedSet) Lists(org.eclipse.collections.impl.factory.Lists) PartitionSortedBag(org.eclipse.collections.api.partition.bag.sorted.PartitionSortedBag) LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList) ImmutableSortedBag(org.eclipse.collections.api.bag.sorted.ImmutableSortedBag) Stacks(org.eclipse.collections.impl.factory.Stacks) LongHashBag(org.eclipse.collections.impl.bag.mutable.primitive.LongHashBag) FastList(org.eclipse.collections.impl.list.mutable.FastList) Iterables(org.eclipse.collections.impl.factory.Iterables) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) TreeBag(org.eclipse.collections.impl.bag.sorted.mutable.TreeBag) PrimitiveTuples(org.eclipse.collections.impl.tuple.primitive.PrimitiveTuples) NoSuchElementException(java.util.NoSuchElementException) Pair(org.eclipse.collections.api.tuple.Pair) MutableCollection(org.eclipse.collections.api.collection.MutableCollection) PrimitiveFunctions(org.eclipse.collections.impl.block.factory.PrimitiveFunctions) Predicates(org.eclipse.collections.impl.block.factory.Predicates) Predicates2(org.eclipse.collections.impl.block.factory.Predicates2) SortedSets(org.eclipse.collections.impl.factory.SortedSets) TreeSortedMap(org.eclipse.collections.impl.map.sorted.mutable.TreeSortedMap) Test(org.junit.Test) PartitionImmutableSortedBag(org.eclipse.collections.api.partition.bag.sorted.PartitionImmutableSortedBag) ImmutableList(org.eclipse.collections.api.list.ImmutableList) Comparator(java.util.Comparator) FloatHashBag(org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag) Assert(org.junit.Assert) Collections(java.util.Collections) IntHashBag(org.eclipse.collections.impl.bag.mutable.primitive.IntHashBag) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 18 with BooleanArrayList

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

the class AbstractBooleanIterableTestCase method containsAllIterable.

@Test
public void containsAllIterable() {
    BooleanIterable emptyCollection = this.newWith();
    Assert.assertTrue(emptyCollection.containsAll(new BooleanArrayList()));
    Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(false)));
    BooleanIterable booleanIterable = this.classUnderTest();
    int size = booleanIterable.size();
    Assert.assertTrue(booleanIterable.containsAll(new BooleanArrayList()));
    Assert.assertEquals(size >= 1, booleanIterable.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertEquals(size >= 2, booleanIterable.containsAll(BooleanArrayList.newListWith(false)));
    Assert.assertEquals(size >= 2, booleanIterable.containsAll(BooleanArrayList.newListWith(true, false)));
    BooleanIterable iterable = this.newWith(true, true, false, false, false);
    Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(false)));
    Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(true, true)));
    Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(false, false)));
    Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(true, false, true)));
    Assert.assertFalse(this.newWith(true, true).containsAll(BooleanArrayList.newListWith(false, true, false)));
    BooleanIterable trueCollection = this.newWith(true, true, true, true);
    Assert.assertFalse(trueCollection.containsAll(BooleanArrayList.newListWith(true, false)));
    BooleanIterable falseCollection = this.newWith(false, false, false, false);
    Assert.assertFalse(falseCollection.containsAll(BooleanArrayList.newListWith(true, false)));
}
Also used : BooleanIterable(org.eclipse.collections.api.BooleanIterable) LazyBooleanIterable(org.eclipse.collections.api.LazyBooleanIterable) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 19 with BooleanArrayList

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

the class ObjectBooleanHashMapValuesTestCase method removeAll_iterable.

@Override
@Test
public void removeAll_iterable() {
    Assert.assertFalse(this.newWith().removeAll(new BooleanArrayList()));
    ObjectBooleanHashMap<Integer> map = ObjectBooleanHashMap.newWithKeysValues(1, true, null, false);
    MutableBooleanCollection collection = map.values();
    Assert.assertFalse(collection.removeAll());
    Assert.assertTrue(collection.removeAll(BooleanArrayList.newListWith(false)));
    Assert.assertFalse(collection.contains(false));
    Assert.assertTrue(collection.contains(true));
    Assert.assertFalse(map.contains(false));
    Assert.assertTrue(map.contains(true));
    Assert.assertTrue(collection.removeAll(BooleanArrayList.newListWith(true)));
    Assert.assertTrue(collection.isEmpty());
    Assert.assertFalse(collection.contains(true));
    Assert.assertFalse(collection.contains(false));
    Assert.assertFalse(map.contains(true));
    Assert.assertFalse(map.contains(false));
    Assert.assertTrue(map.isEmpty());
    ObjectBooleanHashMap<Integer> map1 = ObjectBooleanHashMap.newWithKeysValues(1, true, null, false);
    MutableBooleanCollection collection1 = map1.values();
    Assert.assertTrue(collection1.removeAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(collection1.isEmpty());
    Assert.assertFalse(collection1.contains(true));
    Assert.assertFalse(collection.contains(false));
    Assert.assertFalse(map1.contains(true));
    Assert.assertFalse(map1.contains(false));
    Assert.assertTrue(map1.isEmpty());
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 20 with BooleanArrayList

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

the class ObjectBooleanHashMapValuesTestCase method containsAllIterable.

@Override
public void containsAllIterable() {
    MutableBooleanCollection emptyCollection1 = this.newWith();
    Assert.assertTrue(emptyCollection1.containsAll(new BooleanArrayList()));
    Assert.assertFalse(emptyCollection1.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertFalse(emptyCollection1.containsAll(BooleanArrayList.newListWith(false)));
    MutableBooleanCollection collection = this.classUnderTest();
    Assert.assertTrue(collection.containsAll(new BooleanArrayList()));
    Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(true)));
    Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(false)));
    Assert.assertTrue(collection.containsAll(BooleanArrayList.newListWith(false, true)));
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)

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