use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList in project eclipse-collections by eclipse.
the class AbstractByteSetTestCase method addAllIterable.
@Override
@Test
public void addAllIterable() {
super.addAllIterable();
MutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31, (byte) -1, (byte) -128);
Assert.assertFalse(set.addAll(new ByteArrayList()));
Assert.assertFalse(set.addAll(ByteArrayList.newListWith((byte) 31, (byte) -1, (byte) -128)));
Assert.assertEquals(ByteHashSet.newSetWith((byte) 0, (byte) 1, (byte) 31, (byte) -1, (byte) -128), set);
Assert.assertTrue(set.addAll(ByteHashSet.newSetWith((byte) 0, (byte) 1, (byte) 2, (byte) 30, (byte) -1, (byte) -128)));
Assert.assertEquals(ByteHashSet.newSetWith((byte) 0, (byte) 1, (byte) 2, (byte) 30, (byte) 31, (byte) -1, (byte) -128), set);
Assert.assertTrue(set.addAll(ByteHashSet.newSetWith((byte) 5)));
Assert.assertEquals(ByteHashSet.newSetWith((byte) 0, (byte) 1, (byte) 2, (byte) 5, (byte) 30, (byte) 31, (byte) 31, (byte) -1, (byte) -128), set);
ByteHashSet set1 = new ByteHashSet();
Assert.assertTrue(set1.addAll((byte) 2, (byte) 35));
Assert.assertEquals(ByteHashSet.newSetWith((byte) 2, (byte) 35), set1);
}
use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList in project eclipse-collections by eclipse.
the class AbstractByteSetTestCase method removeAll_iterable.
@Override
@Test
public void removeAll_iterable() {
super.removeAll_iterable();
MutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31, (byte) 63, (byte) 100, (byte) 127, (byte) -1, (byte) -35, (byte) -64, (byte) -100, (byte) -128);
Assert.assertFalse(set.removeAll(new ByteArrayList()));
Assert.assertFalse(set.removeAll(ByteArrayList.newListWith((byte) 15, (byte) 98, (byte) -98, (byte) -127)));
Assert.assertEquals(ByteHashSet.newSetWith((byte) 0, (byte) 1, (byte) 31, (byte) 63, (byte) 100, (byte) 127, (byte) -1, (byte) -35, (byte) -64, (byte) -100, (byte) -128), set);
Assert.assertTrue(set.removeAll(ByteHashSet.newSetWith((byte) 0, (byte) 31, (byte) -128, (byte) -100)));
Assert.assertEquals(ByteHashSet.newSetWith((byte) 1, (byte) 63, (byte) 100, (byte) 127, (byte) -1, (byte) -35, (byte) -64), set);
Assert.assertTrue(set.removeAll(ByteHashSet.newSetWith((byte) 1, (byte) 63, (byte) 100, (byte) 127, (byte) -1, (byte) -35, (byte) -64)));
Assert.assertEquals(new ByteHashSet(), set);
Assert.assertFalse(set.removeAll(ByteHashSet.newSetWith((byte) 1)));
Assert.assertEquals(new ByteHashSet(), set);
}
use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList in project eclipse-collections by eclipse.
the class ArrayIterateTest method collectByteWithTarget.
@Test
public void collectByteWithTarget() {
Integer[] objectArray = { -1, 0, 42 };
ByteArrayList target = new ByteArrayList();
ByteArrayList result = ArrayIterate.collectByte(objectArray, PrimitiveFunctions.unboxIntegerToByte(), target);
Assert.assertEquals(this.getExpectedByteResults(), result);
Assert.assertSame("Target List not returned as result", target, result);
}
use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList 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.impl.list.mutable.primitive.ByteArrayList in project eclipse-collections by eclipse.
the class TreeSortedSet method collectByte.
@Override
public MutableByteList collectByte(ByteFunction<? super T> byteFunction) {
ByteArrayList result = new ByteArrayList(this.size());
this.forEach(new CollectByteProcedure<>(byteFunction, result));
return result;
}
Aggregations