use of org.eclipse.collections.impl.bag.mutable.primitive.ByteHashBag in project eclipse-collections by eclipse.
the class MapIterableTestCase method collectByteWithTarget.
@Test
public void collectByteWithTarget() {
ByteHashBag target = new ByteHashBag();
MapIterable<String, String> map = this.newMapWithKeysValues("One", "1", "Two", "2", "Three", "3");
ByteHashBag result = map.collectByte(Byte::parseByte, target);
Assert.assertSame("Target sent as parameter not returned", target, result);
Assert.assertEquals(ByteHashBag.newBagWith((byte) 1, (byte) 2, (byte) 3), result.toBag());
}
use of org.eclipse.collections.impl.bag.mutable.primitive.ByteHashBag in project eclipse-collections by eclipse.
the class ImmutableBagTestCase method collectByteWithTarget.
@Override
@Test
public void collectByteWithTarget() {
super.collectByteWithTarget();
ByteHashBag target = new ByteHashBag();
ByteHashBag result = this.newBag().collectByte(Byte::parseByte, target);
Assert.assertSame("Target sent as parameter not returned", target, result);
Assert.assertEquals(this.numKeys(), result.sizeDistinct());
for (int i = 1; i <= this.numKeys(); i++) {
Assert.assertEquals(i, result.occurrencesOf((byte) i));
}
}
use of org.eclipse.collections.impl.bag.mutable.primitive.ByteHashBag in project eclipse-collections by eclipse.
the class MapIterateTest method collectByteWithTarget.
@Test
public void collectByteWithTarget() {
ByteHashBag target = new ByteHashBag();
ByteHashBag result = MapIterate.collectByte(MapIterateTest.newLittleMap(), PrimitiveFunctions.unboxIntegerToByte(), target);
Assert.assertEquals(ByteHashBag.newBagWith((byte) 1, (byte) 2), result.toBag());
Assert.assertSame("Target sent as parameter was not returned as result", target, result);
}
Aggregations