Search in sources :

Example 11 with ImmutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.

the class ImmutableBooleanHashSetTest method newWithout.

@Override
@Test
public void newWithout() {
    ImmutableBooleanCollection collection3 = this.newWith(true, false);
    ImmutableBooleanCollection collection2 = collection3.newWithout(true);
    ImmutableBooleanCollection collection1 = collection3.newWithout(false);
    this.assertSizeAndContains(collection1, true);
    this.assertSizeAndContains(collection2, false);
}
Also used : ImmutableBooleanCollection(org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection) Test(org.junit.Test)

Example 12 with ImmutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanListTestCase method newWithAll.

@Override
@Test
public void newWithAll() {
    ImmutableBooleanCollection booleanCollection = this.classUnderTest();
    MutableBooleanList list = booleanCollection.toList();
    ImmutableBooleanCollection collection = booleanCollection.newWithAll(this.newMutableCollectionWith(true));
    ImmutableBooleanCollection collection0 = booleanCollection.newWithAll(this.newMutableCollectionWith(true, false));
    ImmutableBooleanCollection collection1 = booleanCollection.newWithAll(this.newMutableCollectionWith(true, false, true));
    ImmutableBooleanCollection collection2 = booleanCollection.newWithAll(this.newMutableCollectionWith(true, false, true, false));
    ImmutableBooleanCollection collection3 = booleanCollection.newWithAll(this.newMutableCollectionWith(true, false, true, false, true));
    ImmutableBooleanCollection collection4 = collection3.newWithAll(this.newMutableCollectionWith(true, false, true, false, 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);
}
Also used : MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) ImmutableBooleanCollection(org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection) Test(org.junit.Test)

Example 13 with ImmutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanListTestCase method newWithoutAll.

@Override
@Test
public void newWithoutAll() {
    ImmutableBooleanCollection immutableBooleanCollection = this.classUnderTest();
    MutableBooleanCollection mutableTrueCollection = this.getTrueCollection(immutableBooleanCollection);
    ImmutableBooleanCollection trueCollection = mutableTrueCollection.toImmutable();
    Assert.assertEquals(this.newMutableCollectionWith(), trueCollection.newWithoutAll(this.newMutableCollectionWith(true, false)));
    Assert.assertEquals(mutableTrueCollection, trueCollection);
    MutableBooleanList list = immutableBooleanCollection.toList();
    list.removeAll(true);
    Assert.assertEquals(list, immutableBooleanCollection.newWithoutAll(this.newMutableCollectionWith(true)));
    Assert.assertEquals(this.newMutableCollectionWith(), immutableBooleanCollection.newWithoutAll(this.newMutableCollectionWith(true, false)));
    ImmutableBooleanCollection collection = this.newWith(true, false, true, false, true);
    Assert.assertEquals(this.newMutableCollectionWith(false, false), collection.newWithoutAll(this.newMutableCollectionWith(true, true)));
    Assert.assertEquals(this.newMutableCollectionWith(), collection.newWithoutAll(this.newMutableCollectionWith(true, false)));
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) MutableBooleanList(org.eclipse.collections.api.list.primitive.MutableBooleanList) ImmutableBooleanCollection(org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection) Test(org.junit.Test)

Example 14 with ImmutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanBagTestCase method testHashCode.

@Override
@Test
public void testHashCode() {
    super.testHashCode();
    ImmutableBooleanCollection collection1 = this.newWith(true, false, true, false);
    ImmutableBooleanCollection collection2 = this.newWith(true, false, false, true);
    ImmutableBooleanCollection collection3 = this.newWith(true, false);
    ImmutableBooleanCollection collection4 = this.newWith(true, true, false);
    Verify.assertEqualsAndHashCode(collection1, collection2);
    Assert.assertNotEquals(collection3.hashCode(), collection4.hashCode());
}
Also used : ImmutableBooleanCollection(org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection) Test(org.junit.Test)

Example 15 with ImmutableBooleanCollection

use of org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection in project eclipse-collections by eclipse.

the class AbstractImmutableBooleanCollectionTestCase method newWithAll.

@Test
public void newWithAll() {
    ImmutableBooleanCollection immutableCollection = this.newWith();
    ImmutableBooleanCollection collection = immutableCollection.newWithAll(this.newMutableCollectionWith(true));
    ImmutableBooleanCollection collection0 = collection.newWithAll(this.newMutableCollectionWith(false));
    ImmutableBooleanCollection collection1 = collection0.newWithAll(this.newMutableCollectionWith(true));
    ImmutableBooleanCollection collection2 = immutableCollection.newWithAll(this.newMutableCollectionWith(true, false, true, false));
    ImmutableBooleanCollection collection3 = immutableCollection.newWithAll(this.newMutableCollectionWith(true, false, true, false, true));
    this.assertSizeAndOccurrences(immutableCollection, 0, 0);
    this.assertSizeAndOccurrences(collection, 1, 0);
    this.assertSizeAndOccurrences(collection0, 1, 1);
    this.assertSizeAndOccurrences(collection1, 2, 1);
    this.assertSizeAndOccurrences(collection2, 2, 2);
    this.assertSizeAndOccurrences(collection3, 3, 2);
}
Also used : ImmutableBooleanCollection(org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection) Test(org.junit.Test)

Aggregations

ImmutableBooleanCollection (org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection)16 Test (org.junit.Test)16 MutableBooleanList (org.eclipse.collections.api.list.primitive.MutableBooleanList)4 MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)1