use of org.eclipse.collections.api.bag.primitive.MutableByteBag in project eclipse-collections by eclipse.
the class AbstractMutableMap method collectByte.
@Override
public MutableByteBag collectByte(ByteFunction<? super V> byteFunction) {
MutableByteBag result = new ByteHashBag();
this.forEach(new CollectByteProcedure<>(byteFunction, result));
return result;
}
use of org.eclipse.collections.api.bag.primitive.MutableByteBag in project eclipse-collections by eclipse.
the class AbstractImmutableMap method collectByte.
@Override
public ImmutableByteBag collectByte(ByteFunction<? super V> byteFunction) {
MutableByteBag result = new ByteHashBag();
this.forEach(new CollectByteProcedure<>(byteFunction, result));
return result.toImmutable();
}
use of org.eclipse.collections.api.bag.primitive.MutableByteBag in project eclipse-collections by eclipse.
the class AbstractBag method collectByte.
@Override
public <R extends MutableByteCollection> R collectByte(ByteFunction<? super T> byteFunction, R target) {
if (target instanceof MutableByteBag) {
MutableByteBag targetBag = (MutableByteBag) target;
this.forEachWithOccurrences((each, occurrences) -> targetBag.addOccurrences(byteFunction.byteValueOf(each), occurrences));
} else {
this.forEachWithOccurrences((each, occurrences) -> {
byte value = byteFunction.byteValueOf(each);
for (int i = 0; i < occurrences; i++) {
target.add(value);
}
});
}
return target;
}
Aggregations