use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method without.
@Test
public void without() {
MutableLongCollection collection = this.newWith(1L, 2L, 3L, 4L, 5L);
Assert.assertSame(collection, collection.without(9L));
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L, 4L, 5L), collection.without(9L));
Assert.assertEquals(this.newMutableCollectionWith(2L, 3L, 4L, 5L), collection.without(1L));
Assert.assertEquals(this.newMutableCollectionWith(3L, 4L, 5L), collection.without(2L));
Assert.assertEquals(this.newMutableCollectionWith(4L, 5L), collection.without(3L));
Assert.assertEquals(this.newMutableCollectionWith(5L), collection.without(4L));
Assert.assertEquals(this.newMutableCollectionWith(), collection.without(5L));
Assert.assertEquals(this.newMutableCollectionWith(), collection.without(6L));
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method clear.
@Test
public void clear() {
MutableLongCollection emptyCollection = this.newWith();
emptyCollection.clear();
Verify.assertSize(0, emptyCollection);
MutableLongCollection collection = this.classUnderTest();
collection.clear();
Verify.assertEmpty(collection);
Verify.assertSize(0, collection);
Assert.assertFalse(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertFalse(collection.contains(2L));
Assert.assertFalse(collection.contains(3L));
MutableLongCollection collection1 = this.newWith(0L, 1L, 31L, 32L);
collection1.clear();
Verify.assertEmpty(collection1);
Verify.assertSize(0, collection1);
Assert.assertFalse(collection1.contains(0L));
Assert.assertFalse(collection1.contains(1L));
Assert.assertFalse(collection1.contains(31L));
Assert.assertFalse(collection1.contains(32L));
MutableLongCollection collection2 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L);
collection2.clear();
Verify.assertSize(0, collection2);
Assert.assertEquals(this.newMutableCollectionWith(), collection2);
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method withAll.
@Test
public void withAll() {
MutableLongCollection emptyCollection = this.newWith();
MutableLongCollection collection = emptyCollection.withAll(this.newMutableCollectionWith(1L));
MutableLongCollection collection0 = this.newWith().withAll(this.newMutableCollectionWith(1L, 2L));
MutableLongCollection collection1 = this.newWith().withAll(this.newMutableCollectionWith(1L, 2L, 3L));
MutableLongCollection collection2 = this.newWith().withAll(this.newMutableCollectionWith(1L, 2L, 3L, 4L));
MutableLongCollection collection3 = this.newWith().withAll(this.newMutableCollectionWith(1L, 2L, 3L, 4L, 5L));
Assert.assertSame(emptyCollection, collection);
Assert.assertEquals(this.newMutableCollectionWith(1L), collection);
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L), collection0);
Assert.assertEquals(this.classUnderTest(), collection1);
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L, 4L), collection2);
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L, 4L, 5L), collection3);
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method removeAll_iterable.
@Test
public void removeAll_iterable() {
MutableLongCollection collection = this.classUnderTest();
Assert.assertFalse(collection.removeAll(this.newMutableCollectionWith()));
Assert.assertFalse(collection.removeAll(this.newMutableCollectionWith(-1L)));
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L), collection);
Assert.assertTrue(collection.removeAll(this.newMutableCollectionWith(1L, 5L)));
Assert.assertEquals(this.newMutableCollectionWith(2L, 3L), collection);
MutableLongCollection collection1 = this.classUnderTest();
Assert.assertTrue(collection1.removeAll(this.newMutableCollectionWith(3L, 2L)));
Assert.assertEquals(this.newMutableCollectionWith(1L), collection1);
MutableLongCollection collection2 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L, 3L);
Assert.assertFalse(collection2.removeAll(new LongArrayList()));
Assert.assertTrue(collection2.removeAll(LongArrayList.newListWith(0L, 1L)));
Assert.assertEquals(this.newMutableCollectionWith(2L, 2L, 2L, 3L), collection2);
Assert.assertFalse(collection2.removeAll(LongArrayList.newListWith(0L)));
Assert.assertTrue(collection2.removeAll(LongArrayList.newListWith(2L)));
Assert.assertEquals(this.newMutableCollectionWith(3L), collection2);
MutableLongCollection collection3 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L);
Assert.assertTrue(collection3.removeAll(LongHashBag.newBagWith(0L, 1L, 1L)));
Assert.assertEquals(this.newMutableCollectionWith(2L, 2L, 2L), collection3);
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method retainAll_iterable.
@Test
public void retainAll_iterable() {
MutableLongCollection collection = this.classUnderTest();
Assert.assertFalse(collection.retainAll(this.newMutableCollectionWith(1L, 2L, 3L)));
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L), collection);
Assert.assertTrue(collection.retainAll(this.newMutableCollectionWith(1L, 2L, 5L)));
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L), collection);
MutableLongCollection collection1 = this.classUnderTest();
Assert.assertTrue(collection1.retainAll(this.newMutableCollectionWith(-3L, 1L)));
Assert.assertEquals(this.newMutableCollectionWith(1L), collection1);
Assert.assertTrue(collection1.retainAll(this.newMutableCollectionWith(-1L)));
Verify.assertEmpty(collection1);
MutableLongCollection collection2 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L);
Assert.assertFalse(collection2.retainAll(this.newMutableCollectionWith(0L, 1L, 2L, 3L)));
Assert.assertTrue(collection2.retainAll(LongArrayList.newListWith(0L, 1L, 3L)));
Assert.assertEquals(this.newMutableCollectionWith(0L, 1L, 1L, 3L, 3L, 3L), collection2);
Assert.assertFalse(collection2.retainAll(LongArrayList.newListWith(0L, 1L, 3L)));
Assert.assertTrue(collection2.retainAll(LongArrayList.newListWith(5L, 3L)));
Assert.assertEquals(this.newMutableCollectionWith(3L, 3L, 3L), collection2);
MutableLongCollection collection3 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L);
Assert.assertTrue(collection3.retainAll(LongHashBag.newBagWith(2L, 8L, 8L, 2L)));
Assert.assertEquals(this.newMutableCollectionWith(2L, 2L, 2L), collection3);
MutableLongCollection collection4 = this.classUnderTest();
Assert.assertTrue(collection4.retainAll(new LongArrayList()));
Verify.assertEmpty(collection4);
}
Aggregations