Java Code Examples for java.util.concurrent.ConcurrentHashMap#contains()

The following examples show how to use java.util.concurrent.ConcurrentHashMap#contains() . 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: ConcurrentHashMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * contains(null) throws NPE
 */
public void testContains_NullPointerException() {
    ConcurrentHashMap c = new ConcurrentHashMap(5);
    try {
        c.contains(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 2
Source File: ConcurrentHashMapTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * contains(null) throws NPE
 */
public void testContains_NullPointerException() {
    ConcurrentHashMap c = new ConcurrentHashMap(5);
    try {
        c.contains(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 3
Source File: TestTezSharedExecutor.java    From tez with Apache License 2.0 4 votes vote down vote up
Counter(ConcurrentHashMap<String, AtomicInteger> map, String tag) {
  if (!map.contains(tag)) {
    map.putIfAbsent(tag, new AtomicInteger(0));
  }
  this.counter = map.get(tag);
}