Search in sources :

Example 6 with FloatHashBag

use of org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag in project eclipse-collections by eclipse.

the class AbstractImmutableMap method collectFloat.

@Override
public ImmutableFloatBag collectFloat(FloatFunction<? super V> floatFunction) {
    MutableFloatBag result = new FloatHashBag();
    this.forEach(new CollectFloatProcedure<>(floatFunction, result));
    return result.toImmutable();
}
Also used : FloatHashBag(org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag) MutableFloatBag(org.eclipse.collections.api.bag.primitive.MutableFloatBag)

Example 7 with FloatHashBag

use of org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag in project eclipse-collections by eclipse.

the class AbstractMutableMap method collectFloat.

@Override
public MutableFloatBag collectFloat(FloatFunction<? super V> floatFunction) {
    MutableFloatBag result = new FloatHashBag();
    this.forEach(new CollectFloatProcedure<>(floatFunction, result));
    return result;
}
Also used : FloatHashBag(org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag) MutableFloatBag(org.eclipse.collections.api.bag.primitive.MutableFloatBag)

Example 8 with FloatHashBag

use of org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag in project eclipse-collections by eclipse.

the class AbstractRichIterableTestCase method collectFloatWithBagTarget.

@Test
public void collectFloatWithBagTarget() {
    FloatHashBag target = new FloatHashBag();
    FloatHashBag result = this.newWith(1, 2, 3, 4).collectFloat(PrimitiveFunctions.unboxIntegerToFloat(), target);
    Assert.assertSame("Target list sent as parameter not returned", target, result);
    Assert.assertEquals(FloatHashBag.newBagWith(1.0f, 2.0f, 3.0f, 4.0f), result);
}
Also used : FloatHashBag(org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag) Test(org.junit.Test)

Aggregations

FloatHashBag (org.eclipse.collections.impl.bag.mutable.primitive.FloatHashBag)8 Test (org.junit.Test)6 MutableFloatBag (org.eclipse.collections.api.bag.primitive.MutableFloatBag)2 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 NoSuchElementException (java.util.NoSuchElementException)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Collectors (java.util.stream.Collectors)1 BooleanIterable (org.eclipse.collections.api.BooleanIterable)1 ByteIterable (org.eclipse.collections.api.ByteIterable)1 CharIterable (org.eclipse.collections.api.CharIterable)1 DoubleIterable (org.eclipse.collections.api.DoubleIterable)1 FloatIterable (org.eclipse.collections.api.FloatIterable)1 IntIterable (org.eclipse.collections.api.IntIterable)1 LongIterable (org.eclipse.collections.api.LongIterable)1 RichIterable (org.eclipse.collections.api.RichIterable)1 ShortIterable (org.eclipse.collections.api.ShortIterable)1