use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class LongLongHashMapValuesTest method contains.
@Override
@Test
public void 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(29L));
Assert.assertFalse(collection.contains(49L));
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class LongLongHashMapValuesTest method asSynchronized.
@Override
@Test
@Ignore
public void asSynchronized() {
MutableLongCollection collection = this.classUnderTest();
Verify.assertInstanceOf(SynchronizedLongCollection.class, collection.asSynchronized());
Assert.assertTrue(collection.asSynchronized().containsAll(this.classUnderTest()));
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class LongLongHashMapValuesTest method retainAll.
@Override
@Test
public void retainAll() {
Assert.assertFalse(this.newWith().retainAll());
Assert.assertFalse(this.newWith().retainAll(1L));
MutableLongLongMap map = newWithKeysValues(0L, 0L, 1L, 1L, 2L, 2L, 3L, 3L);
MutableLongCollection collection = map.values();
Assert.assertFalse(collection.retainAll(0L, 1L, 2L, 3L));
Assert.assertTrue(collection.retainAll(0L, 2L, 3L, 5L));
Assert.assertTrue(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertTrue(collection.contains(2L));
Assert.assertTrue(collection.contains(3L));
Assert.assertFalse(collection.contains(5L));
Assert.assertTrue(map.contains(0L));
Assert.assertFalse(map.contains(1L));
Assert.assertTrue(map.contains(2L));
Assert.assertTrue(map.contains(3L));
Assert.assertFalse(map.contains(5L));
Assert.assertTrue(collection.retainAll(2L, 3L, 5L));
Assert.assertFalse(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertTrue(collection.contains(2L));
Assert.assertTrue(collection.contains(3L));
Assert.assertFalse(collection.contains(5L));
Assert.assertFalse(map.contains(0L));
Assert.assertFalse(map.contains(1L));
Assert.assertTrue(map.contains(2L));
Assert.assertTrue(map.contains(3L));
Assert.assertFalse(map.contains(5L));
Assert.assertTrue(collection.retainAll(3L, 5L));
Assert.assertFalse(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertFalse(collection.contains(2L));
Assert.assertTrue(collection.contains(3L));
Assert.assertFalse(collection.contains(5L));
Assert.assertFalse(map.contains(0L));
Assert.assertFalse(map.contains(1L));
Assert.assertFalse(map.contains(2L));
Assert.assertTrue(map.contains(3L));
Assert.assertFalse(map.contains(5L));
Assert.assertTrue(collection.retainAll(0L, 0L, 1L));
Assert.assertTrue(collection.isEmpty());
Assert.assertFalse(collection.contains(0L));
Assert.assertFalse(collection.contains(1L));
Assert.assertFalse(collection.contains(2L));
Assert.assertFalse(collection.contains(3L));
Assert.assertFalse(collection.contains(5L));
Assert.assertFalse(map.contains(0L));
Assert.assertFalse(map.contains(1L));
Assert.assertFalse(map.contains(2L));
Assert.assertFalse(map.contains(3L));
Assert.assertFalse(map.contains(5L));
Assert.assertTrue(map.isEmpty());
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class LongLongHashMapValuesTest method remove.
@Override
@Test
public void remove() {
MutableLongLongMap map = newWithKeysValues(1L, 1L, 2L, 2L, 3L, 3L);
MutableLongCollection collection = map.values();
Assert.assertTrue(collection.remove(3L));
Assert.assertFalse(collection.contains(3L));
Assert.assertTrue(collection.contains(1L));
Assert.assertTrue(collection.contains(2L));
Assert.assertFalse(map.contains(3L));
Assert.assertTrue(map.contains(1L));
Assert.assertTrue(map.contains(2L));
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method longIterator_with_remove.
@Test
public void longIterator_with_remove() {
MutableLongCollection longIterable = this.newWith(0L, 1L, 31L, 32L);
final MutableLongIterator iterator = longIterable.longIterator();
while (iterator.hasNext()) {
iterator.next();
iterator.remove();
}
Verify.assertEmpty(longIterable);
Verify.assertThrows(NoSuchElementException.class, new Runnable() {
@Override
public void run() {
iterator.next();
}
});
}
Aggregations