本文整理匯總了Java中java.util.concurrent.ConcurrentSkipListMap.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java ConcurrentSkipListMap.remove方法的具體用法?Java ConcurrentSkipListMap.remove怎麽用?Java ConcurrentSkipListMap.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.concurrent.ConcurrentSkipListMap
的用法示例。
在下文中一共展示了ConcurrentSkipListMap.remove方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testPollFirstEntry
import java.util.concurrent.ConcurrentSkipListMap; //導入方法依賴的package包/類
/**
* pollFirstEntry returns entries in order
*/
public void testPollFirstEntry() {
ConcurrentSkipListMap map = map5();
Map.Entry e = map.pollFirstEntry();
assertEquals(one, e.getKey());
assertEquals("A", e.getValue());
e = map.pollFirstEntry();
assertEquals(two, e.getKey());
map.put(one, "A");
e = map.pollFirstEntry();
assertEquals(one, e.getKey());
assertEquals("A", e.getValue());
e = map.pollFirstEntry();
assertEquals(three, e.getKey());
map.remove(four);
e = map.pollFirstEntry();
assertEquals(five, e.getKey());
try {
e.setValue("A");
shouldThrow();
} catch (UnsupportedOperationException success) {}
e = map.pollFirstEntry();
assertNull(e);
}
示例2: testPollLastEntry
import java.util.concurrent.ConcurrentSkipListMap; //導入方法依賴的package包/類
/**
* pollLastEntry returns entries in order
*/
public void testPollLastEntry() {
ConcurrentSkipListMap map = map5();
Map.Entry e = map.pollLastEntry();
assertEquals(five, e.getKey());
assertEquals("E", e.getValue());
e = map.pollLastEntry();
assertEquals(four, e.getKey());
map.put(five, "E");
e = map.pollLastEntry();
assertEquals(five, e.getKey());
assertEquals("E", e.getValue());
e = map.pollLastEntry();
assertEquals(three, e.getKey());
map.remove(two);
e = map.pollLastEntry();
assertEquals(one, e.getKey());
try {
e.setValue("E");
shouldThrow();
} catch (UnsupportedOperationException success) {}
e = map.pollLastEntry();
assertNull(e);
}
示例3: testRemove
import java.util.concurrent.ConcurrentSkipListMap; //導入方法依賴的package包/類
/**
* remove removes the correct key-value pair from the map
*/
public void testRemove() {
ConcurrentSkipListMap map = map5();
map.remove(five);
assertEquals(4, map.size());
assertFalse(map.containsKey(five));
}
示例4: testRemove2
import java.util.concurrent.ConcurrentSkipListMap; //導入方法依賴的package包/類
/**
* remove(key,value) removes only if pair present
*/
public void testRemove2() {
ConcurrentSkipListMap map = map5();
assertTrue(map.containsKey(five));
assertEquals("E", map.get(five));
map.remove(five, "E");
assertEquals(4, map.size());
assertFalse(map.containsKey(five));
map.remove(four, "A");
assertEquals(4, map.size());
assertTrue(map.containsKey(four));
}
示例5: testRemove1_NullPointerException
import java.util.concurrent.ConcurrentSkipListMap; //導入方法依賴的package包/類
/**
* remove(null) throws NPE
*/
public void testRemove1_NullPointerException() {
ConcurrentSkipListMap c = new ConcurrentSkipListMap();
c.put("sadsdf", "asdads");
try {
c.remove(null);
shouldThrow();
} catch (NullPointerException success) {}
}
示例6: testRemove2_NullPointerException
import java.util.concurrent.ConcurrentSkipListMap; //導入方法依賴的package包/類
/**
* remove(null, x) throws NPE
*/
public void testRemove2_NullPointerException() {
ConcurrentSkipListMap c = new ConcurrentSkipListMap();
c.put("sadsdf", "asdads");
try {
c.remove(null, "whatever");
shouldThrow();
} catch (NullPointerException success) {}
}