当前位置: 首页>>代码示例>>Java>>正文


Java ConcurrentSkipListSet.add方法代码示例

本文整理汇总了Java中java.util.concurrent.ConcurrentSkipListSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentSkipListSet.add方法的具体用法?Java ConcurrentSkipListSet.add怎么用?Java ConcurrentSkipListSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.ConcurrentSkipListSet的用法示例。


在下文中一共展示了ConcurrentSkipListSet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createOrUpdate

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
private void createOrUpdate(NitriteId id, String field, String text) {
    try {
        NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
                = indexMetaService.getIndexMap(field);
        Set<String> words = tokenizerService.tokenize(text);

        Object fieldLock = indexMetaService.getFieldLock(field);
        for (String word : words) {
            ConcurrentSkipListSet<NitriteId> nitriteIds = indexMap.get(word);

            synchronized (fieldLock) {
                if (nitriteIds == null) {
                    nitriteIds = new ConcurrentSkipListSet<>();
                    indexMap.put(word, nitriteIds);
                }
            }

            nitriteIds.add(id);
        }
    } catch (IOException ioe) {
        throw new IndexingException(errorMessage(
                "could not write full-text index data for " + text,
                IE_FAILED_TO_WRITE_FTS_DATA), ioe);
    }
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:26,代码来源:NitriteTextIndexingService.java

示例2: testAddNonComparable

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * Add of non-Comparable throws CCE
 */
public void testAddNonComparable() {
    ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    try {
        q.add(new Object());
        q.add(new Object());
        shouldThrow();
    } catch (ClassCastException success) {
        assertTrue(q.size() < 2);
        for (int i = 0, size = q.size(); i < size; i++)
            assertSame(Object.class, q.pollFirst().getClass());
        assertNull(q.pollFirst());
        assertTrue(q.isEmpty());
        assertEquals(0, q.size());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ConcurrentSkipListSetTest.java

示例3: 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

示例4: insertTmpValue

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
public void insertTmpValue(String className, Object value) {
	ConcurrentSkipListSet<Object> constantSet = null;

	if (tmpSetMap.containsKey(className)) {
		constantSet = tmpSetMap.get(className);
	} else {
		constantSet = new ConcurrentSkipListSet<Object>();
		tmpSetMap.put(className, constantSet);
	}
	constantSet.add(value);
	allValuesSet.add(value);
	
	isEmpty = false;
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:15,代码来源:ConstantContainer.java

示例5: addProperty

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
public synchronized void addProperty(Property property) {
    ConcurrentSkipListMap<String, ConcurrentSkipListSet<Property>> propertiesByKey = propertiesByNameAndKey.get(property.getName());
    if (propertiesByKey == null) {
        propertiesByKey = new ConcurrentSkipListMap<>();
        this.propertiesByNameAndKey.put(property.getName(), propertiesByKey);
    }
    ConcurrentSkipListSet<Property> properties = propertiesByKey.get(property.getKey());
    if (properties == null) {
        properties = new ConcurrentSkipListSet<>();
        propertiesByKey.put(property.getKey(), properties);
    }
    properties.add(property);
    this.propertiesList.add(property);
}
 
开发者ID:mware-solutions,项目名称:memory-graph,代码行数:15,代码来源:PropertyCollection.java

示例6: ProcessThread

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
public ProcessThread(File mafFile, long startPos, long chunkSize, ConcurrentSkipListSet<SubjectEntry> subjectInfo_Set,
		ConcurrentSkipListSet<Long> batchSet, ArrayList<Object[]> readInfos, boolean firstThread) {
	this.mafFile = mafFile;
	this.startPos = startPos;
	this.chunkSize = chunkSize;
	this.subjectInfo_Set = subjectInfo_Set;
	this.batchSet = batchSet;
	this.readInfos = readInfos;

	if (firstThread)
		batchSet.add(0L);

}
 
开发者ID:BenjaminAlbrecht84,项目名称:DAA_Converter,代码行数:14,代码来源:MAF_Converter.java

示例7: set5

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * Returns a new set of first 5 ints.
 */
private static NavigableSet set5() {
    ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    assertTrue(q.isEmpty());
    q.add(one);
    q.add(two);
    q.add(three);
    q.add(four);
    q.add(five);
    q.add(zero);
    q.add(seven);
    NavigableSet s = q.subSet(one, true, seven, false);
    assertEquals(5, s.size());
    return s;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ConcurrentSkipListSubSetTest.java

示例8: dset5

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * Returns a new set of first 5 negative ints.
 */
private static NavigableSet dset5() {
    ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    assertTrue(q.isEmpty());
    q.add(m1);
    q.add(m2);
    q.add(m3);
    q.add(m4);
    q.add(m5);
    NavigableSet s = q.descendingSet();
    assertEquals(5, s.size());
    return s;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:ConcurrentSkipListSubSetTest.java

示例9: set5

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * Returns a new set of first 5 ints.
 */
private static ConcurrentSkipListSet set5() {
    ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    assertTrue(q.isEmpty());
    q.add(one);
    q.add(two);
    q.add(three);
    q.add(four);
    q.add(five);
    assertEquals(5, q.size());
    return q;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:ConcurrentSkipListSetTest.java

示例10: testEmpty

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * isEmpty is true before add, false after
 */
public void testEmpty() {
    ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    assertTrue(q.isEmpty());
    q.add(new Integer(1));
    assertFalse(q.isEmpty());
    q.add(new Integer(2));
    q.pollFirst();
    q.pollFirst();
    assertTrue(q.isEmpty());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ConcurrentSkipListSetTest.java

示例11: testSize

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * size changes when elements added and removed
 */
public void testSize() {
    ConcurrentSkipListSet q = populatedSet(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(SIZE - i, q.size());
        q.pollFirst();
    }
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.size());
        q.add(new Integer(i));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:ConcurrentSkipListSetTest.java

示例12: testAddNull

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * add(null) throws NPE
 */
public void testAddNull() {
    ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    try {
        q.add(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:ConcurrentSkipListSetTest.java

示例13: testClear

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * clear removes all elements
 */
public void testClear() {
    ConcurrentSkipListSet q = populatedSet(SIZE);
    q.clear();
    assertTrue(q.isEmpty());
    assertEquals(0, q.size());
    q.add(new Integer(1));
    assertFalse(q.isEmpty());
    q.clear();
    assertTrue(q.isEmpty());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ConcurrentSkipListSetTest.java

示例14: testContainsAll

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * containsAll(c) is true when c contains a subset of elements
 */
public void testContainsAll() {
    ConcurrentSkipListSet q = populatedSet(SIZE);
    ConcurrentSkipListSet p = new ConcurrentSkipListSet();
    for (int i = 0; i < SIZE; ++i) {
        assertTrue(q.containsAll(p));
        assertFalse(p.containsAll(q));
        p.add(new Integer(i));
    }
    assertTrue(p.containsAll(q));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ConcurrentSkipListSetTest.java

示例15: addMarket

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * Add a new market to the financialMarket object
 * @param category - in what category it is going to add to
 * @param market - the actual market data
 */
public void addMarket(String category, Market market) {
    if (financialMarketData.get(category) != null) {
        financialMarketData.get(category).add(market);
    }else {
        ConcurrentSkipListSet<Market> list = new ConcurrentSkipListSet<>();
        list.add(market);
        financialMarketData.put(category, list);
    }
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:15,代码来源:FinancialMarket.java


注:本文中的java.util.concurrent.ConcurrentSkipListSet.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。