use of org.eclipse.collections.impl.bag.mutable.primitive.DoubleHashBag in project eclipse-collections by eclipse.
the class ImmutableBagTestCase method collectDoubleWithTarget.
@Override
@Test
public void collectDoubleWithTarget() {
super.collectDoubleWithTarget();
DoubleHashBag target = new DoubleHashBag();
DoubleHashBag result = this.newBag().collectDouble(Double::parseDouble, 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(i));
}
}
use of org.eclipse.collections.impl.bag.mutable.primitive.DoubleHashBag in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectDoubleWithBagTarget.
@Test
public void collectDoubleWithBagTarget() {
DoubleHashBag target = new DoubleHashBag();
DoubleHashBag result = this.newWith(1, 2, 3, 4).collectDouble(PrimitiveFunctions.unboxIntegerToDouble(), target);
Assert.assertSame("Target list sent as parameter not returned", target, result);
Assert.assertEquals(DoubleHashBag.newBagWith(1.0d, 2.0d, 3.0d, 4.0d), result);
}
use of org.eclipse.collections.impl.bag.mutable.primitive.DoubleHashBag in project eclipse-collections by eclipse.
the class ImmutableEmptySortedBagTest method collectDouble_target.
@Override
@Test
public void collectDouble_target() {
ImmutableSortedBag<Integer> bag = this.classUnderTest();
Assert.assertEquals(new DoubleArrayList(), bag.collectDouble(PrimitiveFunctions.unboxIntegerToDouble(), new DoubleArrayList()));
ImmutableSortedBag<Integer> bag2 = this.classUnderTest();
Assert.assertEquals(new DoubleHashBag(), bag2.collectDouble(PrimitiveFunctions.unboxIntegerToDouble(), new DoubleHashBag()));
}
Aggregations