Search in sources :

Example 11 with ImmutableBooleanBag

use of org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanBagTestCase method appendString.

@Override
@Test
public void appendString() {
    super.appendString();
    StringBuilder appendable1 = new StringBuilder();
    this.newWith(true, true, true).appendString(appendable1);
    Assert.assertEquals("true, true, true", appendable1.toString());
    StringBuilder appendable2 = new StringBuilder();
    ImmutableBooleanBag bag1 = this.newWith(false, false, true);
    bag1.appendString(appendable2);
    Assert.assertTrue(appendable2.toString(), "false, false, true".equals(appendable2.toString()) || "true, false, false".equals(appendable2.toString()) || "false, true, false".equals(appendable2.toString()));
}
Also used : ImmutableBooleanBag(org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag) Test(org.junit.Test)

Example 12 with ImmutableBooleanBag

use of org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanBagTestCase method anySatisfy.

@Override
@Test
public void anySatisfy() {
    super.anySatisfy();
    long[] count = { 0 };
    ImmutableBooleanBag bag = this.newWith(false, true, false);
    Assert.assertTrue(bag.anySatisfy(value -> {
        count[0]++;
        return value;
    }));
    Assert.assertEquals(2L, count[0]);
}
Also used : BooleanToObjectFunction(org.eclipse.collections.api.block.function.primitive.BooleanToObjectFunction) AbstractImmutableBooleanCollectionTestCase(org.eclipse.collections.impl.collection.immutable.primitive.AbstractImmutableBooleanCollectionTestCase) BooleanIterator(org.eclipse.collections.api.iterator.BooleanIterator) BooleanHashBag(org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag) Test(org.junit.Test) Verify(org.eclipse.collections.impl.test.Verify) MutableBag(org.eclipse.collections.api.bag.MutableBag) ImmutableBooleanBag(org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag) ImmutableBooleanCollection(org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection) BooleanBags(org.eclipse.collections.impl.factory.primitive.BooleanBags) HashBag(org.eclipse.collections.impl.bag.mutable.HashBag) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Assert(org.junit.Assert) MutableBooleanBag(org.eclipse.collections.api.bag.primitive.MutableBooleanBag) ImmutableBooleanBag(org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag) Test(org.junit.Test)

Example 13 with ImmutableBooleanBag

use of org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanBagTestCase method noneSatisfy.

@Override
@Test
public void noneSatisfy() {
    super.noneSatisfy();
    ImmutableBooleanBag bag = this.newWith(false, true, false);
    Assert.assertFalse(bag.noneSatisfy(value -> value));
}
Also used : BooleanToObjectFunction(org.eclipse.collections.api.block.function.primitive.BooleanToObjectFunction) AbstractImmutableBooleanCollectionTestCase(org.eclipse.collections.impl.collection.immutable.primitive.AbstractImmutableBooleanCollectionTestCase) BooleanIterator(org.eclipse.collections.api.iterator.BooleanIterator) BooleanHashBag(org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag) Test(org.junit.Test) Verify(org.eclipse.collections.impl.test.Verify) MutableBag(org.eclipse.collections.api.bag.MutableBag) ImmutableBooleanBag(org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag) ImmutableBooleanCollection(org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection) BooleanBags(org.eclipse.collections.impl.factory.primitive.BooleanBags) HashBag(org.eclipse.collections.impl.bag.mutable.HashBag) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) Assert(org.junit.Assert) MutableBooleanBag(org.eclipse.collections.api.bag.primitive.MutableBooleanBag) ImmutableBooleanBag(org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag) Test(org.junit.Test)

Aggregations

ImmutableBooleanBag (org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag)13 Test (org.junit.Test)13 BooleanHashBag (org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag)5 MutableBag (org.eclipse.collections.api.bag.MutableBag)4 MutableBooleanBag (org.eclipse.collections.api.bag.primitive.MutableBooleanBag)4 BooleanToObjectFunction (org.eclipse.collections.api.block.function.primitive.BooleanToObjectFunction)4 ImmutableBooleanCollection (org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection)4 BooleanIterator (org.eclipse.collections.api.iterator.BooleanIterator)4 MutableBooleanList (org.eclipse.collections.api.list.primitive.MutableBooleanList)4 HashBag (org.eclipse.collections.impl.bag.mutable.HashBag)4 AbstractImmutableBooleanCollectionTestCase (org.eclipse.collections.impl.collection.immutable.primitive.AbstractImmutableBooleanCollectionTestCase)4 BooleanBags (org.eclipse.collections.impl.factory.primitive.BooleanBags)4 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)4 Verify (org.eclipse.collections.impl.test.Verify)4 Assert (org.junit.Assert)4