Java Code Examples for java.util.concurrent.ConcurrentNavigableMap#putIfAbsent()

The following examples show how to use java.util.concurrent.ConcurrentNavigableMap#putIfAbsent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConcurrentSkipListSubMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = map5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 2
Source File: ConcurrentSkipListSubMapTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testDescendingPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = dmap5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 3
Source File: ConcurrentSkipListSubMapTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = map5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 4
Source File: RoleMatcher.java    From anno4j with Apache License 2.0 5 votes vote down vote up
private void addPath(
		ConcurrentNavigableMap<String, ConcurrentMap<String, Collection<Class<?>>>> map,
		String suffix, String prefix, Class<?> role) {
	ConcurrentMap<String, Collection<Class<?>>> m, o;
	m = map.get(suffix);
	if (m == null) {
		m = new ConcurrentHashMap<String, Collection<Class<?>>>();
		o = map.putIfAbsent(suffix, m);
		if (o != null) {
			m = o;
		}
	}
	add(m, prefix, role);
}
 
Example 5
Source File: RoleMatcher.java    From anno4j with Apache License 2.0 5 votes vote down vote up
private void addPathPrefix(
		ConcurrentNavigableMap<String, ConcurrentNavigableMap<String, Collection<Class<?>>>> map,
		String suffix, String prefix, Class<?> role) {
	ConcurrentNavigableMap<String, Collection<Class<?>>> m, o;
	m = map.get(suffix);
	if (m == null) {
		m = new ConcurrentSkipListMap<String, Collection<Class<?>>>();
		o = map.putIfAbsent(suffix, m);
		if (o != null) {
			m = o;
		}
	}
	add(m, prefix, role);
}
 
Example 6
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testDescendingPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = dmap5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 7
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = map5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 8
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testDescendingPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = dmap5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 9
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = map5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 10
Source File: BTreeMapTest5.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = map5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 11
Source File: ConcurrentSkipListSubMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * putIfAbsent(null, x) throws NPE
 */
public void testDescendingPutIfAbsent1_NullPointerException() {
    try {
        ConcurrentNavigableMap c = dmap5();
        c.putIfAbsent(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 12
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testDescendingPutIfAbsent() {
    ConcurrentNavigableMap map = dmap5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}
 
Example 13
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testPutIfAbsent() {
    ConcurrentNavigableMap map = map5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}
 
Example 14
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testPutIfAbsent() {
    ConcurrentNavigableMap map = map5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}
 
Example 15
Source File: ConcurrentSkipListSubMapJUnitTest.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testDescendingPutIfAbsent() {
    ConcurrentNavigableMap map = dmap5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}
 
Example 16
Source File: BTreeMapTest5.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testPutIfAbsent() {
    ConcurrentNavigableMap map = map5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}
 
Example 17
Source File: ConcurrentSkipListSubMapTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testPutIfAbsent() {
    ConcurrentNavigableMap map = map5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}
 
Example 18
Source File: ConcurrentSkipListSubMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testDescendingPutIfAbsent() {
    ConcurrentNavigableMap map = dmap5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}
 
Example 19
Source File: ConcurrentSkipListSubMapTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testDescendingPutIfAbsent() {
    ConcurrentNavigableMap map = dmap5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}
 
Example 20
Source File: ConcurrentSkipListSubMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * putIfAbsent works when the given key is not present
 */
public void testPutIfAbsent() {
    ConcurrentNavigableMap map = map5();
    map.putIfAbsent(six, "Z");
    assertTrue(map.containsKey(six));
}