use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractImmutableCollectionTestCase method collectBoolean.
@Test
public void collectBoolean() {
ImmutableCollection<Integer> integers = this.classUnderTest();
ImmutableBooleanCollection immutableCollection = integers.collectBoolean(PrimitiveFunctions.integerIsPositive());
Verify.assertSize(1, immutableCollection);
}
use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanCollectionTestCase method newWithoutAll.
@Test
public void newWithoutAll() {
ImmutableBooleanCollection collection3 = this.newWith(true, false, true, true);
ImmutableBooleanCollection collection2 = collection3.newWithoutAll(this.newMutableCollectionWith(true));
ImmutableBooleanCollection collection1 = collection2.newWithoutAll(this.newMutableCollectionWith(false));
ImmutableBooleanCollection collection0 = collection1.newWithoutAll(this.newMutableCollectionWith(true));
ImmutableBooleanCollection collection4 = collection0.newWithoutAll(this.newMutableCollectionWith(false));
this.assertSizeAndOccurrences(collection2, 0, 1);
this.assertSizeAndOccurrences(collection1, 0, 0);
this.assertSizeAndOccurrences(collection0, 0, 0);
this.assertSizeAndOccurrences(collection4, 0, 0);
}
use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanCollectionTestCase method newWithout.
@Test
public void newWithout() {
ImmutableBooleanCollection collection3 = this.newWith(true, false, true, false, true);
ImmutableBooleanCollection collection2 = collection3.newWithout(true);
ImmutableBooleanCollection collection1 = collection2.newWithout(false);
ImmutableBooleanCollection collection0 = collection1.newWithout(true);
ImmutableBooleanCollection collection4 = collection0.newWithout(false);
ImmutableBooleanCollection collection5 = collection4.newWithout(true);
ImmutableBooleanCollection collection6 = collection5.newWithout(false);
this.assertSizeAndOccurrences(collection6, 0, 0);
this.assertSizeAndOccurrences(collection5, 0, 0);
this.assertSizeAndOccurrences(collection4, 1, 0);
this.assertSizeAndOccurrences(collection0, 1, 1);
this.assertSizeAndOccurrences(collection1, 2, 1);
this.assertSizeAndOccurrences(collection2, 2, 2);
}
use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method newWithout.
@Override
@Test
public void newWithout() {
ImmutableBooleanCollection trueCollection = this.getTrueCollection(this.classUnderTest()).toImmutable();
Assert.assertSame(trueCollection, trueCollection.newWithout(false));
Assert.assertNotSame(trueCollection, trueCollection.newWithout(true));
ImmutableBooleanCollection collection = this.classUnderTest();
MutableBooleanList list = collection.toList();
Assert.assertEquals(list.without(true), collection.newWithout(true));
MutableBooleanList list1 = collection.toList();
Assert.assertEquals(list1.without(false), collection.newWithout(false));
Assert.assertEquals(this.classUnderTest(), collection);
}
use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractImmutableBooleanListTestCase method testNewWith.
@Override
@Test
public void testNewWith() {
ImmutableBooleanCollection booleanCollection = this.classUnderTest();
MutableBooleanList list = booleanCollection.toList();
ImmutableBooleanCollection collection = booleanCollection.newWith(true);
ImmutableBooleanCollection collection0 = booleanCollection.newWith(true).newWith(false);
ImmutableBooleanCollection collection1 = booleanCollection.newWith(true).newWith(false).newWith(true);
ImmutableBooleanCollection collection2 = booleanCollection.newWith(true).newWith(false).newWith(true).newWith(false);
ImmutableBooleanCollection collection3 = booleanCollection.newWith(true).newWith(false).newWith(true).newWith(false).newWith(true);
ImmutableBooleanCollection collection4 = collection3.newWith(true).newWith(false).newWith(true).newWith(false).newWith(true);
Assert.assertEquals(list, booleanCollection);
Assert.assertEquals(list.with(true), collection);
Assert.assertEquals(list.with(false), collection0);
Assert.assertEquals(list.with(true), collection1);
Assert.assertEquals(list.with(false), collection2);
Assert.assertEquals(list.with(true), collection3);
list.addAll(true, false, true, false, true);
Assert.assertEquals(list, collection4);
}
Aggregations