當前位置: 首頁>>代碼示例>>Java>>正文


Java ConcurrentSkipListSet.tailSet方法代碼示例

本文整理匯總了Java中java.util.concurrent.ConcurrentSkipListSet.tailSet方法的典型用法代碼示例。如果您正苦於以下問題:Java ConcurrentSkipListSet.tailSet方法的具體用法?Java ConcurrentSkipListSet.tailSet怎麽用?Java ConcurrentSkipListSet.tailSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.concurrent.ConcurrentSkipListSet的用法示例。


在下文中一共展示了ConcurrentSkipListSet.tailSet方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testTailSetContents

import java.util.concurrent.ConcurrentSkipListSet; //導入方法依賴的package包/類
/**
 * tailSet returns set with keys in requested range
 */
public void testTailSetContents() {
    ConcurrentSkipListSet set = set5();
    SortedSet sm = set.tailSet(two);
    assertFalse(sm.contains(one));
    assertTrue(sm.contains(two));
    assertTrue(sm.contains(three));
    assertTrue(sm.contains(four));
    assertTrue(sm.contains(five));
    Iterator i = sm.iterator();
    Object k;
    k = (Integer)(i.next());
    assertEquals(two, k);
    k = (Integer)(i.next());
    assertEquals(three, k);
    k = (Integer)(i.next());
    assertEquals(four, k);
    k = (Integer)(i.next());
    assertEquals(five, k);
    assertFalse(i.hasNext());

    SortedSet ssm = sm.tailSet(four);
    assertEquals(four, ssm.first());
    assertEquals(five, ssm.last());
    assertTrue(ssm.remove(four));
    assertEquals(1, ssm.size());
    assertEquals(3, sm.size());
    assertEquals(4, set.size());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:ConcurrentSkipListSetTest.java

示例2: set0

import java.util.concurrent.ConcurrentSkipListSet; //導入方法依賴的package包/類
private static NavigableSet set0() {
    ConcurrentSkipListSet set = new ConcurrentSkipListSet();
    assertTrue(set.isEmpty());
    return set.tailSet(m1, true);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:ConcurrentSkipListSubSetTest.java


注:本文中的java.util.concurrent.ConcurrentSkipListSet.tailSet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。