use of org.eclipse.collections.api.FloatIterable in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectFloatWithTarget.
@Test
public void collectFloatWithTarget() {
MutableFloatCollection target = new FloatArrayList();
FloatIterable result = this.newWith(1, 2, 3, 4).collectFloat(PrimitiveFunctions.unboxIntegerToFloat(), target);
Assert.assertSame("Target list sent as parameter not returned", target, result);
Assert.assertEquals(FloatHashBag.newBagWith(1.0f, 2.0f, 3.0f, 4.0f), result.toBag());
}
use of org.eclipse.collections.api.FloatIterable in project eclipse-collections by eclipse.
the class MapIterableTestCase method collectFloat.
@Test
public void collectFloat() {
MapIterable<String, String> map = this.newMapWithKeysValues("One", "1", "Two", "2", "Three", "3");
FloatIterable actual = map.collectFloat(Float::parseFloat);
Assert.assertEquals(FloatHashBag.newBagWith(1.0f, 2.0f, 3.0f), actual.toBag());
}
use of org.eclipse.collections.api.FloatIterable in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectFloat.
@Test
public void collectFloat() {
FloatIterable result = this.newWith(1, 2, 3, 4).collectFloat(PrimitiveFunctions.unboxIntegerToFloat());
Assert.assertEquals(FloatBags.mutable.of(1.0f, 2.0f, 3.0f, 4.0f), result.toBag());
Assert.assertEquals(FloatBags.mutable.of(1.0f, 2.0f, 3.0f, 4.0f), FloatBags.mutable.ofAll(result));
}
Aggregations