use of org.eclipse.collections.api.DoubleIterable in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectDoubleWithTarget.
@Test
public void collectDoubleWithTarget() {
MutableDoubleCollection target = new DoubleArrayList();
DoubleIterable 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.toBag());
}
use of org.eclipse.collections.api.DoubleIterable in project eclipse-collections by eclipse.
the class MapIterableTestCase method collectDouble.
@Test
public void collectDouble() {
MapIterable<String, String> map = this.newMapWithKeysValues("One", "1", "Two", "2", "Three", "3");
DoubleIterable actual = map.collectDouble(Double::parseDouble);
Assert.assertEquals(DoubleHashBag.newBagWith(1.0d, 2.0d, 3.0d), actual.toBag());
}
use of org.eclipse.collections.api.DoubleIterable in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectDouble.
@Test
public void collectDouble() {
DoubleIterable result = this.newWith(1, 2, 3, 4).collectDouble(PrimitiveFunctions.unboxIntegerToDouble());
Assert.assertEquals(DoubleBags.mutable.of(1.0d, 2.0d, 3.0d, 4.0d), result.toBag());
Assert.assertEquals(DoubleBags.mutable.of(1.0d, 2.0d, 3.0d, 4.0d), DoubleBags.mutable.ofAll(result));
}
Aggregations