use of org.eclipse.collections.impl.bag.mutable.primitive.ShortHashBag in project eclipse-collections by eclipse.
the class MapIterateTest method collectShortWithTarget.
@Test
public void collectShortWithTarget() {
ShortHashBag target = new ShortHashBag();
MutableShortCollection result = MapIterate.collectShort(MapIterateTest.newLittleMap(), PrimitiveFunctions.unboxIntegerToShort(), target);
Assert.assertEquals(ShortHashBag.newBagWith((short) 1, (short) 2), result.toBag());
Assert.assertSame("Target sent as parameter was not returned as result", target, result);
}
use of org.eclipse.collections.impl.bag.mutable.primitive.ShortHashBag in project eclipse-collections by eclipse.
the class MapIterableTestCase method collectShortWithTarget.
@Test
public void collectShortWithTarget() {
ShortHashBag target = new ShortHashBag();
MapIterable<String, String> map = this.newMapWithKeysValues("One", "1", "Two", "2", "Three", "3");
ShortHashBag result = map.collectShort(Short::parseShort, target);
Assert.assertSame("Target sent as parameter not returned", target, result);
Assert.assertEquals(ShortHashBag.newBagWith((short) 1, (short) 2, (short) 3), result.toBag());
}
use of org.eclipse.collections.impl.bag.mutable.primitive.ShortHashBag in project eclipse-collections by eclipse.
the class ImmutableEmptySortedBagTest method collectShort_target.
@Override
@Test
public void collectShort_target() {
ImmutableSortedBag<Integer> bag = this.classUnderTest();
Assert.assertEquals(new ShortArrayList(), bag.collectShort(PrimitiveFunctions.unboxIntegerToShort(), new ShortArrayList()));
ImmutableSortedBag<Integer> bag2 = this.classUnderTest();
Assert.assertEquals(new ShortHashBag(), bag2.collectShort(PrimitiveFunctions.unboxIntegerToShort(), new ShortHashBag()));
}
Aggregations