use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class BooleanListsTest method newListWithList.
@Test
public void newListWithList() {
ImmutableBooleanList list = BooleanLists.immutable.of();
BooleanArrayList booleanArrayList = BooleanArrayList.newListWith(true);
Assert.assertEquals(list = list.newWith(true), booleanArrayList.toImmutable());
Assert.assertEquals(list = list.newWith(false), booleanArrayList.with(false).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(false), booleanArrayList.with(false).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(false), booleanArrayList.with(false).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
Assert.assertEquals(list = list.newWith(false), booleanArrayList.with(false).toImmutable());
Assert.assertEquals(list = list.newWith(true), booleanArrayList.with(true).toImmutable());
}
use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method testEquals.
@Override
@Test
public void testEquals() {
super.testEquals();
ImmutableBooleanList list1 = this.newWith(true, false, true, true);
ImmutableBooleanList list2 = this.newWith(true, true, false, true);
Assert.assertNotEquals(list1, list2);
}
use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method lastIndexOf.
@Test
public void lastIndexOf() {
ImmutableBooleanList list = this.classUnderTest();
int size = list.size();
Assert.assertEquals((size & 1) == 0 ? size - 2 : size - 1, list.lastIndexOf(true));
Assert.assertEquals((size & 1) == 0 ? size - 1 : size - 2, list.lastIndexOf(false));
MutableBooleanList mutableList = this.newMutableCollectionWith();
for (int i = 0; i < list.size(); i++) {
mutableList.add(false);
}
Assert.assertEquals(-1L, mutableList.toImmutable().lastIndexOf(true));
}
use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method newWithOn64ElementCollection.
@Test
public void newWithOn64ElementCollection() {
BooleanArrayList sixtyFourElementCollection = new BooleanArrayList();
for (int i = 0; i < 64; i++) {
sixtyFourElementCollection.add(true);
}
ImmutableBooleanList immutableBooleanList = sixtyFourElementCollection.toImmutable();
Assert.assertEquals(sixtyFourElementCollection, immutableBooleanList);
ImmutableBooleanList newImmutableBooleanList = immutableBooleanList.newWith(false);
Assert.assertFalse(newImmutableBooleanList.get(64));
ImmutableBooleanList newImmutableBooleanList1 = immutableBooleanList.newWith(true);
Assert.assertTrue(newImmutableBooleanList1.get(64));
}
use of org.eclipse.collections.api.list.primitive.ImmutableBooleanList in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method toReversed.
@Test
public void toReversed() {
Assert.assertEquals(BooleanArrayList.newListWith(true, true, false, false), this.newWith(false, false, true, true).toReversed());
ImmutableBooleanList originalList = this.newWith(true, true, false, false);
Assert.assertNotSame(originalList, originalList.toReversed());
}
Aggregations