use of org.eclipse.collections.api.collection.primitive.MutableDoubleCollection in project eclipse-collections by eclipse.
the class AbstractLazyIterableTestCase method collectDoubleWithTarget.
@Test
public void collectDoubleWithTarget() {
MutableDoubleCollection target = new DoubleArrayList();
MutableDoubleCollection result = this.lazyIterable.collectDouble(PrimitiveFunctions.unboxIntegerToDouble(), target);
Assert.assertEquals(DoubleArrayList.newListWith(1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d), result.toList());
Assert.assertSame("Target list sent as parameter not returned", target, result);
}
use of org.eclipse.collections.api.collection.primitive.MutableDoubleCollection 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.collection.primitive.MutableDoubleCollection in project eclipse-collections by eclipse.
the class IterateTest method collectDouble.
@Test
public void collectDouble() {
this.iterables.each(each -> {
MutableDoubleCollection result = Iterate.collectDouble(each, PrimitiveFunctions.unboxIntegerToDouble());
Assert.assertTrue(result.containsAll(1.0d, 2.0d, 3.0d, 4.0d, 5.0d));
});
Verify.assertThrows(IllegalArgumentException.class, () -> Iterate.collectDouble(null, PrimitiveFunctions.unboxIntegerToDouble()));
}
use of org.eclipse.collections.api.collection.primitive.MutableDoubleCollection in project eclipse-collections by eclipse.
the class IterateTest method collectDoubleWithTarget.
@Test
public void collectDoubleWithTarget() {
this.iterables.each(each -> {
MutableDoubleCollection expected = new DoubleArrayList();
MutableDoubleCollection actual = Iterate.collectDouble(each, PrimitiveFunctions.unboxIntegerToDouble(), expected);
Assert.assertTrue(actual.containsAll(1.0d, 2.0d, 3.0d, 4.0d, 5.0d));
Assert.assertSame("Target list sent as parameter not returned", expected, actual);
});
Verify.assertThrows(IllegalArgumentException.class, () -> Iterate.collectDouble(null, PrimitiveFunctions.unboxIntegerToDouble(), new DoubleArrayList()));
}
use of org.eclipse.collections.api.collection.primitive.MutableDoubleCollection in project eclipse-collections by eclipse.
the class MapIterateTest method collectDouble.
@Test
public void collectDouble() {
MutableDoubleCollection result = MapIterate.collectDouble(MapIterateTest.newLittleMap(), PrimitiveFunctions.unboxIntegerToDouble());
Assert.assertEquals(DoubleHashBag.newBagWith(1, 2), result.toBag());
}
Aggregations