本文整理汇总了Java中java.util.concurrent.ConcurrentNavigableMap.pollLastEntry方法的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentNavigableMap.pollLastEntry方法的具体用法?Java ConcurrentNavigableMap.pollLastEntry怎么用?Java ConcurrentNavigableMap.pollLastEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.concurrent.ConcurrentNavigableMap
的用法示例。
在下文中一共展示了ConcurrentNavigableMap.pollLastEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPollLastEntry
import java.util.concurrent.ConcurrentNavigableMap; //导入方法依赖的package包/类
/**
* pollLastEntry returns entries in order
*/
public void testPollLastEntry() {
ConcurrentNavigableMap 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);
}
示例2: testDescendingPollLastEntry
import java.util.concurrent.ConcurrentNavigableMap; //导入方法依赖的package包/类
/**
* pollLastEntry returns entries in order
*/
public void testDescendingPollLastEntry() {
ConcurrentNavigableMap map = dmap5();
Map.Entry e = map.pollLastEntry();
assertEquals(m5, e.getKey());
assertEquals("E", e.getValue());
e = map.pollLastEntry();
assertEquals(m4, e.getKey());
map.put(m5, "E");
e = map.pollLastEntry();
assertEquals(m5, e.getKey());
assertEquals("E", e.getValue());
e = map.pollLastEntry();
assertEquals(m3, e.getKey());
map.remove(m2);
e = map.pollLastEntry();
assertEquals(m1, e.getKey());
try {
e.setValue("E");
shouldThrow();
} catch (UnsupportedOperationException success) {}
e = map.pollLastEntry();
assertNull(e);
}