本文整理汇总了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());
}
示例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;
}
示例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);
}
示例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);
}
}
}
}
}
}
}
}
示例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;
}
示例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);
}
}
}
}