当前位置: 首页>>代码示例>>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;未经允许,请勿转载。