@Test public void collectShortWithTarget() { ShortHashBag target = new ShortHashBag(); ShortHashBag result = this.newBag().collectShort(Short::parseShort, target); Assert.assertEquals(this.numKeys(), result.sizeDistinct()); for (int i = 1; i <= this.numKeys(); i++) { Assert.assertEquals(i, result.occurrencesOf((short) i)); } }
@Override @Test public void collectShort() { MutableBag<Integer> integers = UnmodifiableBag.of(HashBag.newBagWith(1, 2, 2, 3, 3, 3)); Assert.assertEquals( ShortHashBag.newBagWith((short) 1, (short) 2, (short) 2, (short) 3, (short) 3, (short) 3), integers.collectShort(PrimitiveFunctions.unboxIntegerToShort())); }