use of org.eclipse.collections.api.list.primitive.MutableFloatList in project eclipse-collections by eclipse.
the class ArrayListIterateTest method collectFloatWithTargetOverOptimizeLimit.
@Test
public void collectFloatWithTargetOverOptimizeLimit() {
ArrayList<Integer> list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT));
MutableFloatList target = new FloatArrayList();
MutableFloatList actual = ArrayListIterate.collectFloat(list, PrimitiveFunctions.unboxIntegerToFloat(), target);
FloatArrayList expected = new FloatArrayList(list.size());
for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) {
expected.add((float) i);
}
Assert.assertEquals(expected, actual);
Assert.assertSame("Target sent as parameter was not returned as result", target, actual);
}
use of org.eclipse.collections.api.list.primitive.MutableFloatList in project eclipse-collections by eclipse.
the class ArrayListIterateTest method collectFloat.
@Test
public void collectFloat() {
ArrayList<Integer> list = this.createIntegerList();
MutableFloatList actual = ArrayListIterate.collectFloat(list, PrimitiveFunctions.unboxIntegerToFloat());
Assert.assertEquals(FloatArrayList.newListWith(-1.0f, 0.0f, 4.0f), actual);
}
use of org.eclipse.collections.api.list.primitive.MutableFloatList in project eclipse-collections by eclipse.
the class ArrayListIterateTest method collectFloatOverOptimizeLimit.
@Test
public void collectFloatOverOptimizeLimit() {
ArrayList<Integer> list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT));
MutableFloatList actual = ArrayListIterate.collectFloat(list, PrimitiveFunctions.unboxIntegerToFloat());
FloatArrayList expected = new FloatArrayList(list.size());
for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) {
expected.add((float) i);
}
Assert.assertEquals(expected, actual);
}
use of org.eclipse.collections.api.list.primitive.MutableFloatList in project eclipse-collections by eclipse.
the class ArrayListIterateTest method collectFloatWithTarget.
@Test
public void collectFloatWithTarget() {
ArrayList<Integer> list = this.createIntegerList();
MutableFloatList target = new FloatArrayList();
MutableFloatList actual = ArrayListIterate.collectFloat(list, PrimitiveFunctions.unboxIntegerToFloat(), target);
Assert.assertSame("Target list sent as parameter not returned", target, actual);
Assert.assertEquals(FloatArrayList.newListWith(-1.0f, 0.0f, 4.0f), actual);
}
use of org.eclipse.collections.api.list.primitive.MutableFloatList in project eclipse-collections by eclipse.
the class AbstractListTestCase method collectFloat.
@Override
public void collectFloat() {
super.collectFloat();
MutableFloatList result = this.newWith(1, 2, 3, 4).collectFloat(PrimitiveFunctions.unboxIntegerToFloat());
Assert.assertEquals(FloatLists.mutable.of(1.0f, 2.0f, 3.0f, 4.0f), result);
}
Aggregations