本文整理匯總了Java中java.util.concurrent.ConcurrentSkipListMap.headMap方法的典型用法代碼示例。如果您正苦於以下問題:Java ConcurrentSkipListMap.headMap方法的具體用法?Java ConcurrentSkipListMap.headMap怎麽用?Java ConcurrentSkipListMap.headMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.concurrent.ConcurrentSkipListMap
的用法示例。
在下文中一共展示了ConcurrentSkipListMap.headMap方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testHeadMapContents
import java.util.concurrent.ConcurrentSkipListMap; //導入方法依賴的package包/類
/**
* headMap returns map with keys in requested range
*/
public void testHeadMapContents() {
ConcurrentSkipListMap map = map5();
NavigableMap sm = map.headMap(four, false);
assertTrue(sm.containsKey(one));
assertTrue(sm.containsKey(two));
assertTrue(sm.containsKey(three));
assertFalse(sm.containsKey(four));
assertFalse(sm.containsKey(five));
Iterator i = sm.keySet().iterator();
Object k;
k = (Integer)(i.next());
assertEquals(one, k);
k = (Integer)(i.next());
assertEquals(two, k);
k = (Integer)(i.next());
assertEquals(three, k);
assertFalse(i.hasNext());
sm.clear();
assertTrue(sm.isEmpty());
assertEquals(2, map.size());
assertEquals(four, map.firstKey());
}