use of org.eclipse.collections.api.bag.primitive.MutableFloatBag 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();
}
use of org.eclipse.collections.api.bag.primitive.MutableFloatBag 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;
}
use of org.eclipse.collections.api.bag.primitive.MutableFloatBag in project eclipse-collections by eclipse.
the class AbstractBag method collectFloat.
@Override
public <R extends MutableFloatCollection> R collectFloat(FloatFunction<? super T> floatFunction, R target) {
if (target instanceof MutableFloatBag) {
MutableFloatBag targetBag = (MutableFloatBag) target;
this.forEachWithOccurrences((each, occurrences) -> targetBag.addOccurrences(floatFunction.floatValueOf(each), occurrences));
} else {
this.forEachWithOccurrences((each, occurrences) -> {
float value = floatFunction.floatValueOf(each);
for (int i = 0; i < occurrences; i++) {
target.add(value);
}
});
}
return target;
}
Aggregations