use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.
the class ConcurrentSkipListMapTest method testHigherKey.
/**
* higherKey returns next element
*/
public void testHigherKey() {
ConcurrentSkipListMap q = map5();
Object e1 = q.higherKey(three);
assertEquals(four, e1);
Object e2 = q.higherKey(zero);
assertEquals(one, e2);
Object e3 = q.higherKey(five);
assertNull(e3);
Object e4 = q.higherKey(six);
assertNull(e4);
}
use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.
the class ConcurrentSkipListMapTest method testPutIfAbsent2.
/**
* putIfAbsent does not add the pair if the key is already present
*/
public void testPutIfAbsent2() {
ConcurrentSkipListMap map = map5();
assertEquals("A", map.putIfAbsent(one, "Z"));
}
use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.
the class ConcurrentSkipListMapTest method testReplace2.
/**
* replace succeeds if the key is already present
*/
public void testReplace2() {
ConcurrentSkipListMap map = map5();
assertNotNull(map.replace(one, "Z"));
assertEquals("Z", map.get(one));
}
use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.
the class ConcurrentSkipListMapTest method testDescendingKeySetDescendingIteratorOrder.
/**
* descending iterator of descendingKeySet is ordered
*/
public void testDescendingKeySetDescendingIteratorOrder() {
ConcurrentSkipListMap map = map5();
NavigableSet s = map.descendingKeySet();
Iterator i = s.descendingIterator();
Integer last = (Integer) i.next();
assertEquals(last, one);
int count = 1;
while (i.hasNext()) {
Integer k = (Integer) i.next();
assertTrue(last.compareTo(k) < 0);
last = k;
++count;
}
assertEquals(5, count);
}
use of java.util.concurrent.ConcurrentSkipListMap in project j2objc by google.
the class ConcurrentSkipListMapTest method testEntrySetToArray.
/**
* entrySet.toArray contains all entries
*/
public void testEntrySetToArray() {
ConcurrentSkipListMap map = map5();
Set s = map.entrySet();
Object[] ar = s.toArray();
assertEquals(5, ar.length);
for (int i = 0; i < 5; ++i) {
assertTrue(map.containsKey(((Map.Entry) (ar[i])).getKey()));
assertTrue(map.containsValue(((Map.Entry) (ar[i])).getValue()));
}
}
Aggregations