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


Java ConcurrentSkipListSet.iterator方法代碼示例

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


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

示例1: testIteratorRemove

import java.util.concurrent.ConcurrentSkipListSet; //導入方法依賴的package包/類
/**
 * iterator.remove removes current element
 */
public void testIteratorRemove() {
    final ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));

    Iterator it = q.iterator();
    it.next();
    it.remove();

    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:ConcurrentSkipListSetTest.java

示例2: getIndex

import java.util.concurrent.ConcurrentSkipListSet; //導入方法依賴的package包/類
/**
 * Get an index out of the indexBook
 * @param countryName
 * @param marketCode
 * @return Index if found such index or return null if it is not found
 */
public Index getIndex(String countryName, String marketCode, String indexCode){
    
    if (indexBook.get(countryName) == null){
        return null;
    }
    
    ConcurrentSkipListSet<Index> indexSet = indexBook.get(countryName).get(marketCode);
    Iterator<Index> itr = indexSet.iterator();
    while (itr.hasNext()){
        Index index = itr.next();
        if (index.getIndexCode().equalsIgnoreCase(indexCode)){
            return index;
        }
    }
    return null;
}
 
開發者ID:ztan5,項目名稱:TechnicalAnalysisTool,代碼行數:23,代碼來源:IndexBook.java

示例3: testIterator

import java.util.concurrent.ConcurrentSkipListSet; //導入方法依賴的package包/類
/**
 * iterator iterates through all elements
 */
public void testIterator() {
    ConcurrentSkipListSet q = populatedSet(SIZE);
    Iterator it = q.iterator();
    int i;
    for (i = 0; it.hasNext(); i++)
        assertTrue(q.contains(it.next()));
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:ConcurrentSkipListSetTest.java

示例4: dump

import java.util.concurrent.ConcurrentSkipListSet; //導入方法依賴的package包/類
/**
 * The method that is used for helping debugging the code
 * Dump whatever we have got inside this IndexBook object
 */
public void dump(){
    Iterator<String> itr = getIndexBook().keySet().iterator();
    while(itr.hasNext()){
        
        String countryName = itr.next();
        System.out.println("------------------------------------");
        System.out.println(" Country Code: " + countryName);
        System.out.println("------------------------------------");

        if (getIndexBook().get(countryName) != null){
            ConcurrentHashMap<String, ConcurrentSkipListSet<Index>> markets = getIndexBook().get(countryName);
            Iterator<String> marketItr = markets.keySet().iterator();
            while(marketItr.hasNext()){
                String marketCode = marketItr.next();
                System.out.println("  <<<< Market Code: >>>" + marketCode);          
                ConcurrentSkipListSet<Index> stockSet = getIndexListSet(countryName, marketCode);
                Iterator<Index> iter = stockSet.iterator();
                while(iter.hasNext()){
                    Index index = iter.next();
                    if (index != null) {
                        String indexCode = index.getIndexCode();
                        String description = index.getDescription();
                        System.out.println("   <<<< Index Code:>>>> " + indexCode);
                        System.out.println(" Description: " + description); 
                        if (index.getStocks() != null && index.getStocks().isEmpty() == false){
                            Iterator<String> itrStock = index.getStocks().iterator();
                            while (itrStock.hasNext()){
                                String stockCode = itrStock.next();
                                System.out.println(" Market Code: " + stockCode); 
                            }
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:ztan5,項目名稱:TechnicalAnalysisTool,代碼行數:42,代碼來源:IndexBook.java

示例5: getMarket

import java.util.concurrent.ConcurrentSkipListSet; //導入方法依賴的package包/類
/**
 * Get the market data out with the specified market code and category
 * @param category the market data search category
 * @param marketCode the market code that is used as the key for search
 * @return market data with the marketCode or null if not found
 */
public Market getMarket(String category, String marketCode) {
    if (financialMarketData.get(category) != null) {
        ConcurrentSkipListSet<Market> markets = financialMarketData.get(category);
        Iterator<Market> iterator = markets.iterator();
        while(iterator.hasNext()) {
            Market market = iterator.next();
            if (market.getMarketCode().compareToIgnoreCase(marketCode)==0) {
                return market;
            }
        }
    }
    return null;
}
 
開發者ID:ztan5,項目名稱:TechnicalAnalysisTool,代碼行數:20,代碼來源:FinancialMarket.java

示例6: removeMarket

import java.util.concurrent.ConcurrentSkipListSet; //導入方法依賴的package包/類
/**
 * Remove this market data from financial market with specified market code
 * This can be used when reload data
 * @param category the market data search category
 * @param marketCode the market code that is going to be removed
 */
public void removeMarket(String category, String marketCode) {
    if (financialMarketData.get(category) != null) {
        ConcurrentSkipListSet<Market> markets = financialMarketData.get(category);
        Iterator<Market> iterator = markets.iterator();
        while(iterator.hasNext()) {
            Market market = iterator.next();
            if (market.getMarketCode().compareToIgnoreCase(marketCode)==0) {
                markets.remove(market);
            }
        }
    }
}
 
開發者ID:ztan5,項目名稱:TechnicalAnalysisTool,代碼行數:19,代碼來源:FinancialMarket.java


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