use of org.eclipse.collections.api.ShortIterable in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectShort.
@Test
public void collectShort() {
ShortIterable result = this.newWith(1, 2, 3, 4).collectShort(PrimitiveFunctions.unboxIntegerToShort());
Assert.assertEquals(ShortBags.mutable.of((short) 1, (short) 2, (short) 3, (short) 4), result.toBag());
Assert.assertEquals(ShortBags.mutable.of((short) 1, (short) 2, (short) 3, (short) 4), ShortBags.mutable.ofAll(result));
}
use of org.eclipse.collections.api.ShortIterable in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectShortWithTarget.
@Test
public void collectShortWithTarget() {
MutableShortCollection target = new ShortArrayList();
ShortIterable result = this.newWith(1, 2, 3, 4).collectShort(PrimitiveFunctions.unboxIntegerToShort(), target);
Assert.assertSame("Target list sent as parameter not returned", target, result);
Assert.assertEquals(ShortHashBag.newBagWith((short) 1, (short) 2, (short) 3, (short) 4), result.toBag());
}
use of org.eclipse.collections.api.ShortIterable in project eclipse-collections by eclipse.
the class MapIterableTestCase method collectShort.
@Test
public void collectShort() {
MapIterable<String, String> map = this.newMapWithKeysValues("One", "1", "Two", "2", "Three", "3");
ShortIterable actual = map.collectShort(Short::parseShort);
Assert.assertEquals(ShortHashBag.newBagWith((short) 1, (short) 2, (short) 3), actual.toBag());
}
Aggregations