use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class BooleanListsTest method newListWithArray.
@SuppressWarnings("RedundantArrayCreation")
@Test
public void newListWithArray() {
ImmutableBooleanList list = BooleanLists.immutable.of();
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(new boolean[] { true }));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(new boolean[] { true, false }));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(new boolean[] { true, false, true }));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(new boolean[] { true, false, true, false }));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(new boolean[] { true, false, true, false, true }));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(new boolean[] { true, false, true, false, true, false }));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(new boolean[] { true, false, true, false, true, false, true }));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(new boolean[] { true, false, true, false, true, false, true, true }));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(new boolean[] { true, false, true, false, true, false, true, true, true }));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(new boolean[] { true, false, true, false, true, false, true, true, true, false }));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(new boolean[] { true, false, true, false, true, false, true, true, true, false, true }));
}
use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class BooleanListsTest method newListWith.
@Test
public void newListWith() {
ImmutableBooleanList list = BooleanLists.immutable.of();
Assert.assertEquals(list, BooleanLists.immutable.of(list.toArray()));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(true));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(true, false));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(true, false, true));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(true, false, true, false));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(true, false, true, false, true));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(true, false, true, false, true, false));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(true, false, true, false, true, false, true));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(true, false, true, false, true, false, true, true));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(true, false, true, false, true, false, true, true, true));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(true, false, true, false, true, false, true, true, true, false));
Assert.assertEquals(list = list.newWith(true), BooleanLists.immutable.of(true, false, true, false, true, false, true, true, true, false, true));
Assert.assertEquals(list = list.newWith(false), BooleanLists.immutable.of(true, false, true, false, true, false, true, true, true, false, true, false));
}
use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method get_throws_index_greater_than_size.
@Test(expected = IndexOutOfBoundsException.class)
public void get_throws_index_greater_than_size() {
ImmutableBooleanList list = this.classUnderTest();
list.get(list.size());
}
use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method injectIntoWithIndex.
@Test
public void injectIntoWithIndex() {
ImmutableBooleanList list = this.newWith(true, false, true);
MutableInteger result = list.injectIntoWithIndex(new MutableInteger(0), (object, value, index) -> object.add((value ? 1 : 0) + index));
Assert.assertEquals(new MutableInteger(5), result);
}
use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method toArray.
@Override
@Test
public void toArray() {
super.toArray();
ImmutableBooleanList list = this.classUnderTest();
Assert.assertEquals(this.classUnderTest().size(), list.toArray().length);
for (int i = 0; i < this.classUnderTest().size(); i++) {
Assert.assertEquals((i & 1) == 0, list.toArray()[i]);
}
}
Aggregations