Search in sources :

Example 1 with BooleanToObjectFunction

use of org.eclipse.collections.api.block.function.primitive.BooleanToObjectFunction in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanBagTestCase method collect.

@Override
@Test
public void collect() {
    super.collect();
    ImmutableBooleanBag bag = this.newWith(true, false, false, true, true, true);
    BooleanToObjectFunction<String> stringValueOf = parameter -> parameter ? "true" : "false";
    Assert.assertEquals(HashBag.newBagWith("true", "false", "false", "true", "true", "true"), bag.collect(stringValueOf));
    ImmutableBooleanBag bag1 = this.newWith(false, false);
    Assert.assertEquals(HashBag.newBagWith("false", "false"), bag1.collect(stringValueOf));
    ImmutableBooleanBag bag2 = this.newWith(true, true);
    Assert.assertEquals(HashBag.newBagWith("true", "true"), bag2.collect(stringValueOf));
}
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 2 with BooleanToObjectFunction

use of org.eclipse.collections.api.block.function.primitive.BooleanToObjectFunction in project eclipse-collections by eclipse.

the class AbstractMutableBooleanBagTestCase method collect.

@Override
@Test
public void collect() {
    super.collect();
    MutableBooleanBag bag = this.newWith(true, false, false, true, true, true);
    BooleanToObjectFunction<String> stringValueOf = parameter -> parameter ? "true" : "false";
    Assert.assertEquals(HashBag.newBagWith("true", "false", "false", "true", "true", "true"), bag.collect(stringValueOf));
    MutableBooleanBag bag1 = this.newWith(false, false);
    Assert.assertEquals(HashBag.newBagWith("false", "false"), bag1.collect(stringValueOf));
    MutableBooleanBag bag2 = this.newWith(true, true);
    Assert.assertEquals(HashBag.newBagWith("true", "true"), bag2.collect(stringValueOf));
}
Also used : BooleanToObjectFunction(org.eclipse.collections.api.block.function.primitive.BooleanToObjectFunction) 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) MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) HashBag(org.eclipse.collections.impl.bag.mutable.HashBag) Lists(org.eclipse.collections.impl.factory.Lists) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) AbstractMutableBooleanCollectionTestCase(org.eclipse.collections.impl.collection.mutable.primitive.AbstractMutableBooleanCollectionTestCase) PrimitiveTuples(org.eclipse.collections.impl.tuple.primitive.PrimitiveTuples) Assert(org.junit.Assert) MutableBooleanBag(org.eclipse.collections.api.bag.primitive.MutableBooleanBag) MutableBooleanBag(org.eclipse.collections.api.bag.primitive.MutableBooleanBag) Test(org.junit.Test)

Aggregations

MutableBag (org.eclipse.collections.api.bag.MutableBag)2 ImmutableBooleanBag (org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag)2 MutableBooleanBag (org.eclipse.collections.api.bag.primitive.MutableBooleanBag)2 BooleanToObjectFunction (org.eclipse.collections.api.block.function.primitive.BooleanToObjectFunction)2 MutableBooleanList (org.eclipse.collections.api.list.primitive.MutableBooleanList)2 HashBag (org.eclipse.collections.impl.bag.mutable.HashBag)2 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)2 Verify (org.eclipse.collections.impl.test.Verify)2 Assert (org.junit.Assert)2 Test (org.junit.Test)2 ImmutableBooleanCollection (org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection)1 MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)1 BooleanIterator (org.eclipse.collections.api.iterator.BooleanIterator)1 BooleanHashBag (org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag)1 AbstractImmutableBooleanCollectionTestCase (org.eclipse.collections.impl.collection.immutable.primitive.AbstractImmutableBooleanCollectionTestCase)1 AbstractMutableBooleanCollectionTestCase (org.eclipse.collections.impl.collection.mutable.primitive.AbstractMutableBooleanCollectionTestCase)1 Lists (org.eclipse.collections.impl.factory.Lists)1 BooleanBags (org.eclipse.collections.impl.factory.primitive.BooleanBags)1 PrimitiveTuples (org.eclipse.collections.impl.tuple.primitive.PrimitiveTuples)1