use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList in project eclipse-collections by eclipse.
the class AbstractLazyIterableTestCase method collectShortWithTarget.
@Test
public void collectShortWithTarget() {
MutableShortCollection target = new ShortArrayList();
MutableShortCollection result = this.lazyIterable.collectShort(PrimitiveFunctions.unboxIntegerToShort(), target);
Assert.assertEquals(ShortArrayList.newListWith((short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 6, (short) 7), result.toList());
Assert.assertSame("Target list sent as parameter not returned", target, result);
}
use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList 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.impl.list.mutable.primitive.ShortArrayList in project eclipse-collections by eclipse.
the class IterateTest method collectShortWithTarget.
@Test
public void collectShortWithTarget() {
this.iterables.each(each -> {
MutableShortCollection expected = new ShortArrayList();
MutableShortCollection actual = Iterate.collectShort(each, PrimitiveFunctions.unboxIntegerToShort(), expected);
Assert.assertTrue(actual.containsAll((short) 1, (short) 2, (short) 3, (short) 4, (short) 5));
Assert.assertSame("Target list sent as parameter not returned", expected, actual);
});
Verify.assertThrows(IllegalArgumentException.class, () -> Iterate.collectShort(null, PrimitiveFunctions.unboxIntegerToShort(), new ShortArrayList()));
}
use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList in project eclipse-collections by eclipse.
the class SortedSetAdapter method collectShort.
@Override
public MutableShortList collectShort(ShortFunction<? super T> shortFunction) {
ShortArrayList result = new ShortArrayList(this.size());
this.forEach(new CollectShortProcedure<>(shortFunction, result));
return result;
}
use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList 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