use of org.eclipse.collections.api.list.primitive.MutableByteList in project eclipse-collections by eclipse.
the class ArrayListIterateTest method collectByteOverOptimizeLimit.
@Test
public void collectByteOverOptimizeLimit() {
ArrayList<Integer> list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT));
MutableByteList actual = ArrayListIterate.collectByte(list, PrimitiveFunctions.unboxIntegerToByte());
ByteArrayList expected = new ByteArrayList(list.size());
for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) {
expected.add((byte) i);
}
Assert.assertEquals(expected, actual);
}
use of org.eclipse.collections.api.list.primitive.MutableByteList in project eclipse-collections by eclipse.
the class ArrayListIterateTest method collectByte.
@Test
public void collectByte() {
ArrayList<Integer> list = this.createIntegerList();
MutableByteList actual = ArrayListIterate.collectByte(list, PrimitiveFunctions.unboxIntegerToByte());
Assert.assertEquals(ByteArrayList.newListWith((byte) -1, (byte) 0, (byte) 4), actual);
}
use of org.eclipse.collections.api.list.primitive.MutableByteList in project eclipse-collections by eclipse.
the class ArrayListIterateTest method collectByteWithTargetOverOptimizeLimit.
@Test
public void collectByteWithTargetOverOptimizeLimit() {
ArrayList<Integer> list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT));
MutableByteList target = new ByteArrayList();
MutableByteList actual = ArrayListIterate.collectByte(list, PrimitiveFunctions.unboxIntegerToByte(), target);
ByteArrayList expected = new ByteArrayList(list.size());
for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) {
expected.add((byte) 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.MutableByteList in project eclipse-collections by eclipse.
the class ArrayListIterateTest method collectByteWithTarget.
@Test
public void collectByteWithTarget() {
ArrayList<Integer> list = this.createIntegerList();
MutableByteList target = new ByteArrayList();
MutableByteList actual = ArrayListIterate.collectByte(list, PrimitiveFunctions.unboxIntegerToByte(), target);
Assert.assertSame("Target list sent as parameter not returned", target, actual);
Assert.assertEquals(ByteArrayList.newListWith((byte) -1, (byte) 0, (byte) 4), actual);
}
use of org.eclipse.collections.api.list.primitive.MutableByteList in project eclipse-collections by eclipse.
the class AbstractListTestCase method collectByte.
@Override
public void collectByte() {
super.collectByte();
MutableByteList result = this.newWith(1, 2, 3, 4).collectByte(PrimitiveFunctions.unboxIntegerToByte());
Assert.assertEquals(ByteLists.mutable.of((byte) 1, (byte) 2, (byte) 3, (byte) 4), result);
}
Aggregations