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