Java Code Examples for java.util.concurrent.ConcurrentHashMap.replace()

The following are Jave code examples for showing how to use replace() of the java.util.concurrent.ConcurrentHashMap class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: openjdk-jdk10   File: ConcurrentHashMapTest.java   View Source Code Vote up 6 votes
/**
 * replace(null, x) throws NPE
 */
public void testReplace_NullPointerException() {
    ConcurrentHashMap c = new ConcurrentHashMap(5);
    try {
        c.replace(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 2
Project: openjdk-jdk10   File: ConcurrentHashMapTest.java   View Source Code Vote up 6 votes
/**
 * replace(null, x, y) throws NPE
 */
public void testReplaceValue_NullPointerException() {
    ConcurrentHashMap c = new ConcurrentHashMap(5);
    try {
        c.replace(null, one, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 3
Project: openjdk-jdk10   File: ConcurrentHashMapTest.java   View Source Code Vote up 6 votes
/**
 * replace(x, null) throws NPE
 */
public void testReplace2_NullPointerException() {
    ConcurrentHashMap c = new ConcurrentHashMap(5);
    try {
        c.replace("whatever", null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 4
Project: openjdk-jdk10   File: ConcurrentHashMapTest.java   View Source Code Vote up 6 votes
/**
 * replace(x, null, y) throws NPE
 */
public void testReplaceValue2_NullPointerException() {
    ConcurrentHashMap c = new ConcurrentHashMap(5);
    try {
        c.replace("whatever", null, "A");
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 5
Project: openjdk-jdk10   File: ConcurrentHashMapTest.java   View Source Code Vote up 6 votes
/**
 * replace(x, y, null) throws NPE
 */
public void testReplaceValue3_NullPointerException() {
    ConcurrentHashMap c = new ConcurrentHashMap(5);
    try {
        c.replace("whatever", one, null);
        shouldThrow();
    } catch (NullPointerException success) {}
}