Search in sources :

Example 1 with MutableLongCollection

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

the class LongLongHashMapValuesTest method asUnmodifiable.

@Override
@Test
@Ignore
public void asUnmodifiable() {
    MutableLongCollection collection = this.classUnderTest();
    Verify.assertInstanceOf(UnmodifiableLongCollection.class, collection.asUnmodifiable());
    Assert.assertTrue(collection.asUnmodifiable().containsAll(this.classUnderTest()));
}
Also used : MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with MutableLongCollection

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

the class LongLongHashMapValuesTest method removeAll_iterable.

@Override
@Test
public void removeAll_iterable() {
    Assert.assertFalse(this.newWith().removeAll(new LongArrayList()));
    Assert.assertFalse(this.newWith().removeAll(LongArrayList.newListWith(1L)));
    MutableLongLongMap map = newWithKeysValues(1L, 1L, 2L, 2L, 3L, 3L);
    MutableLongCollection collection = map.values();
    Assert.assertFalse(collection.removeAll());
    Assert.assertTrue(collection.removeAll(LongArrayList.newListWith(1L, 5L)));
    Assert.assertFalse(collection.contains(1L));
    Assert.assertTrue(collection.contains(2L));
    Assert.assertTrue(collection.contains(3L));
    Assert.assertFalse(map.contains(1L));
    Assert.assertTrue(map.contains(2L));
    Assert.assertTrue(map.contains(3L));
    Assert.assertTrue(collection.removeAll(LongArrayList.newListWith(3L, 2L)));
    Assert.assertTrue(collection.isEmpty());
    Assert.assertFalse(collection.contains(1L));
    Assert.assertFalse(collection.contains(2L));
    Assert.assertFalse(collection.contains(3L));
    Assert.assertFalse(map.contains(1L));
    Assert.assertFalse(map.contains(2L));
    Assert.assertFalse(map.contains(3L));
    Assert.assertTrue(map.isEmpty());
}
Also used : LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList) MutableLongLongMap(org.eclipse.collections.api.map.primitive.MutableLongLongMap) MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) Test(org.junit.Test)

Example 3 with MutableLongCollection

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

the class AbstractMutableLongCollectionTestCase method removeAll.

@Test
public void removeAll() {
    Assert.assertFalse(this.newWith().removeAll());
    Assert.assertFalse(this.newWith().removeAll(1L));
    MutableLongCollection collection = this.classUnderTest();
    Assert.assertFalse(collection.removeAll());
    Assert.assertFalse(collection.removeAll(-1L));
    Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L), collection);
    Assert.assertTrue(collection.removeAll(1L, 5L));
    Assert.assertEquals(this.newMutableCollectionWith(2L, 3L), collection);
    Assert.assertTrue(collection.removeAll(3L, 2L));
    Assert.assertEquals(this.newMutableCollectionWith(), collection);
    MutableLongCollection collection1 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L);
    Assert.assertFalse(collection1.removeAll());
    Assert.assertTrue(collection1.removeAll(0L, 1L));
    Assert.assertEquals(this.newMutableCollectionWith(2L, 2L, 2L), collection1);
}
Also used : MutableLongCollection(org.eclipse.collections.api.collection.primitive.MutableLongCollection) Test(org.junit.Test)

Example 4 with MutableLongCollection

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

the class AbstractMutableLongCollectionTestCase method addAllArray.

@Test
public void addAllArray() {
    MutableLongCollection collection = this.classUnderTest();
    Assert.assertFalse(collection.addAll());
    Assert.assertTrue(collection.addAll(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 5 with MutableLongCollection

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

the class AbstractMutableLongCollectionTestCase method contains.

@Override
@Test
public void contains() {
    super.contains();
    MutableLongCollection collection = this.newWith(14L, 2L, 30L, 31L, 32L, 35L, 0L, 1L);
    Assert.assertFalse(collection.contains(29L));
    Assert.assertFalse(collection.contains(49L));
    long[] numbers = { 14L, 2L, 30L, 31L, 32L, 35L, 0L, 1L };
    for (long number : numbers) {
        Assert.assertTrue(collection.contains(number));
        Assert.assertTrue(collection.remove(number));
        Assert.assertFalse(collection.contains(number));
    }
    Assert.assertFalse(collection.contains(-1L));
    Assert.assertFalse(collection.contains(29L));
    Assert.assertFalse(collection.contains(49L));
}
Also used : 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