Search in sources :

Example 6 with MutableLongCollection

use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.

the class AbstractMutableLongCollectionTestCase method withoutAll.

@Test
public void withoutAll() {
    MutableLongCollection collection = this.newWith(1L, 2L, 3L, 4L, 5L);
    Assert.assertSame(collection, collection.withoutAll(this.newMutableCollectionWith(8L, 9L)));
    Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L, 4L, 5L), collection.withoutAll(this.newMutableCollectionWith(8L, 9L)));
    Assert.assertEquals(this.newMutableCollectionWith(2L, 3L, 4L), collection.withoutAll(this.newMutableCollectionWith(1L, 5L)));
    Assert.assertEquals(this.newMutableCollectionWith(3L, 4L), collection.withoutAll(this.newMutableCollectionWith(2L, 20L)));
    Assert.assertEquals(this.newMutableCollectionWith(), collection.withoutAll(this.newMutableCollectionWith(3L, 4L)));
    Assert.assertEquals(this.newMutableCollectionWith(), collection.withoutAll(this.newMutableCollectionWith(9L)));
    MutableLongCollection collection1 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L);
    Assert.assertEquals(this.newMutableCollectionWith(2L, 2L, 2L), collection1.withoutAll(LongHashBag.newBagWith(0L, 1L)));
}
Also used : MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) Test(org.junit.Test)

Example 7 with MutableLongCollection

use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.

the class AbstractMutableLongCollectionTestCase method with.

@Test
public void with() {
    MutableLongCollection emptyCollection = this.newWith();
    MutableLongCollection collection = emptyCollection.with(1L);
    MutableLongCollection collection0 = this.newWith().with(1L).with(2L);
    MutableLongCollection collection1 = this.newWith().with(1L).with(2L).with(3L);
    MutableLongCollection collection2 = this.newWith().with(1L).with(2L).with(3L).with(4L);
    MutableLongCollection collection3 = this.newWith().with(1L).with(2L).with(3L).with(4L).with(5L);
    Assert.assertSame(emptyCollection, collection);
    Assert.assertEquals(this.newMutableCollectionWith(1L), collection);
    Assert.assertEquals(this.newMutableCollectionWith(1L, 2L), collection0);
    Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L), collection1);
    Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L, 4L), collection2);
    Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L, 4L, 5L), collection3);
}
Also used : MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) Test(org.junit.Test)

Example 8 with MutableLongCollection

use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.

the class AbstractMutableLongCollectionTestCase method longIterator_throws_for_remove_before_next.

@Test
public void longIterator_throws_for_remove_before_next() {
    MutableLongCollection longIterable = this.classUnderTest();
    final MutableLongIterator iterator = longIterable.longIterator();
    Assert.assertTrue(iterator.hasNext());
    Verify.assertThrows(IllegalStateException.class, new Runnable() {

        @Override
        public void run() {
            iterator.remove();
        }
    });
}
Also used : MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) MutableLongIterator(org.eclipse.collections.api.iterator.MutableLongIterator) Test(org.junit.Test)

Example 9 with MutableLongCollection

use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.

the class AbstractMutableLongCollectionTestCase method addAllIterable.

@Test
public void addAllIterable() {
    MutableLongCollection collection = this.classUnderTest();
    Assert.assertFalse(collection.addAll(this.newMutableCollectionWith()));
    Assert.assertTrue(collection.addAll(this.newMutableCollectionWith(4L, 5L, 6L)));
    Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L, 4L, 5L, 6L), collection);
}
Also used : MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) Test(org.junit.Test)

Example 10 with MutableLongCollection

use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.

the class LongLongHashMapValuesTest method clear.

@Override
@Test
public void clear() {
    MutableLongCollection emptyCollection = this.newWith();
    emptyCollection.clear();
    Verify.assertSize(0, emptyCollection);
    MutableLongLongMap map = newWithKeysValues(1L, 1L, 2L, 2L, 3L, 3L);
    MutableLongCollection collection = map.values();
    collection.clear();
    Verify.assertEmpty(collection);
    Verify.assertEmpty(map);
    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, 2L);
    collection2.clear();
    Verify.assertSize(0, collection2);
}
Also used : MutableLongLongMap(org.eclipse.collections.api.map.primitive.MutableLongLongMap) MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) Test(org.junit.Test)

Aggregations

MutableLongCollection (org.eclipse.collections.api.collection.primitive.MutableLongCollection)30 Test (org.junit.Test)30 MutableLongLongMap (org.eclipse.collections.api.map.primitive.MutableLongLongMap)6 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)5 MutableLongIterator (org.eclipse.collections.api.iterator.MutableLongIterator)4 LongIterator (org.eclipse.collections.api.iterator.LongIterator)2 Ignore (org.junit.Ignore)2