use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method set5.
/**
* Returns a new set of first 5 ints.
*/
private NavigableSet set5() {
ConcurrentSkipListSet q = new ConcurrentSkipListSet();
assertTrue(q.isEmpty());
q.add(one);
q.add(two);
q.add(three);
q.add(four);
q.add(five);
q.add(zero);
q.add(seven);
NavigableSet s = q.subSet(one, true, seven, false);
assertEquals(5, s.size());
return s;
}
use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testDescendingSubSetContents2.
public void testDescendingSubSetContents2() {
NavigableSet set = dset5();
SortedSet sm = set.subSet(m2, m3);
assertEquals(1, sm.size());
assertEquals(m2, sm.first());
assertEquals(m2, sm.last());
assertFalse(sm.contains(m1));
assertTrue(sm.contains(m2));
assertFalse(sm.contains(m3));
assertFalse(sm.contains(m4));
assertFalse(sm.contains(m5));
Iterator i = sm.iterator();
Object k;
k = (Integer) (i.next());
assertEquals(m2, k);
assertFalse(i.hasNext());
Iterator j = sm.iterator();
j.next();
j.remove();
assertFalse(set.contains(m2));
assertEquals(4, set.size());
assertEquals(0, sm.size());
assertTrue(sm.isEmpty());
assertFalse(sm.remove(m3));
assertEquals(4, set.size());
}
use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testDescendingCeiling.
/**
* ceiling returns next element
*/
public void testDescendingCeiling() {
NavigableSet q = dset5();
Object e1 = q.ceiling(m3);
assertEquals(m3, e1);
Object e2 = q.ceiling(zero);
assertEquals(m1, e2);
Object e3 = q.ceiling(m5);
assertEquals(m5, e3);
Object e4 = q.ceiling(m6);
assertNull(e4);
}
use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testAddNull.
/**
* add(null) throws NPE
*/
public void testAddNull() {
NavigableSet q = set0();
try {
q.add(null);
shouldThrow();
} catch (NullPointerException success) {
}
}
use of java.util.NavigableSet in project mapdb by jankotek.
the class ConcurrentSkipListSubSetTest method testIterator.
/**
* iterator iterates through all elements
*/
public void testIterator() {
NavigableSet q = populatedSet(SIZE);
Iterator it = q.iterator();
int i;
for (i = 0; it.hasNext(); i++) assertTrue(q.contains(it.next()));
assertEquals(i, SIZE);
assertIteratorExhausted(it);
}
Aggregations