public boolean contains(final Object value) { return backingMap.contains(value); }
ConcurrentHashMap<String, Integer> myMap = new ConcurrentHashMap<String, Integer>(); // some stuff if (!myMap.contains("key")) { myMap.put("key", 3); }
/** * Register a new contentType to charSet mapping. * @param contentType Content-type to register * @param charSet charSet associated with the content-type */ public void registerCharsetMapping(String contentType, String charSet) { if (knownCharsets.contains(contentType)) { log.warn("{} is already registered; re-registering"); } knownCharsets.put(contentType, charSet); }
@NoWarning("GC_UNRELATED_TYPES") public boolean testContainsConcurrentHashMap(Integer i) { return concurrentHashMap.contains(i); }
@ExpectWarning("GC_UNRELATED_TYPES") public boolean testContainsConcurrentHashMap(String s) { return concurrentHashMap.contains(s); }
/** * Block indexing. * * @param nodeId Node. */ @SuppressWarnings("SuspiciousMethodCalls") private static CountDownLatch blockIndexing(UUID nodeId) { assertFalse(BLOCKS.contains(nodeId)); CountDownLatch idxLatch = new CountDownLatch(1); BLOCKS.put(nodeId, new T3<>(new CountDownLatch(1), new AtomicBoolean(), idxLatch)); return idxLatch; }
/** * Block indexing. * * @param nodeId Node. */ @SuppressWarnings("SuspiciousMethodCalls") private static CountDownLatch blockIndexing(UUID nodeId) { assertFalse(BLOCKS.contains(nodeId)); CountDownLatch idxLatch = new CountDownLatch(1); BLOCKS.put(nodeId, new T3<>(new CountDownLatch(1), new AtomicBoolean(), idxLatch)); return idxLatch; }
protected Processor getProcessorByName(NutConfig config,String name) throws Exception { if (name.startsWith("ioc:") && name.length() > 4) { if (config.getIoc() == null) throw new IllegalArgumentException("getProcessorByName " + name + " but no ioc !"); return config.getIoc().get(Processor.class, name.substring(4).trim()); } else { Class<?> klass = null; if (name.startsWith("!")) { name = name.substring(1); if (disabledProcessor.contains(name)) return null; try { klass = Lang.loadClass(name); } catch (Throwable e) { log.info("Optional processor class not found, disabled : " + name); disabledProcessor.put(name, name); return null; } return (Processor) Mirror.me(klass).born(); } return (Processor) Mirror.me(Lang.loadClass(name)).born(); } } }
if (!topologyIdtoSem.contains(topologyId)) { topologyIdtoSem.putIfAbsent(topologyId, new Semaphore(0));
if (CLASS_2_ANNOTATION_VALIDATOR_MAP.contains(clazz)) { return;
/** * Returns whether or not a class is already bound. * @param cls * @return */ public boolean hasBinding(Class<?> cls) { return bindJsonApiToEntity.contains(cls); }
/** * Return <code>true</code> if writes have been disabled for the named * index. * * @param name * The index name. * * @return <code>true</code> if writes are disabled for that index. */ public boolean isDisabledWrites(final String name) { return disabledShards.contains(name); }
/** * Returns whether or not a class is already bound. * @param cls * @return */ public boolean hasBinding(Class<?> cls) { return bindJsonApiToEntity.contains(cls); }
public boolean contains(String ifaceName) { String key = ifaceName != null ? ifaceName : ""; return components.contains(key); }
@Override public String addRoute(String routeName, AltoNorthboundRoute route) { if (routes.contains(routeName)) { return null; } routes.put(routeName, route); return "/alto/" + routeName; }
/** * Register a new contentType to charSet mapping. * @param contentType Content-type to register * @param charSet charSet associated with the content-type */ public void registerCharsetMapping(String contentType, String charSet) { if (knownCharsets.contains(contentType)) { log.warn("{} is already registered; re-registering"); } knownCharsets.put(contentType, charSet); }
/** * Register a new contentType to charSet mapping. * @param contentType Content-type to register * @param charSet charSet associated with the content-type */ public void registerCharsetMapping(String contentType, String charSet) { if (knownCharsets.contains(contentType)) { log.warn("{} is already registered; re-registering"); } knownCharsets.put(contentType, charSet); }
void leave() { assert activeThreads.contains(Thread.currentThread()); activeThreads.remove(Thread.currentThread()); } }
@Override public void unregisterService(String name, String uri) { try { if (uriToZnodePath.contains(uri)) { curatorFramework.delete().forPath(uriToZnodePath.get(uri)); } } catch (Exception ex) { throw new RuntimeException("Could not unregister service \"" + name + "\", with URI \"" + uri + "\": " + ex.getLocalizedMessage()); } }
@SuppressWarnings("unchecked") public static <T extends GeneratedMessageV3> ProtoMessageCodec<T> getProtoMessageCodec( @Nonnull Class<T> cls) { Preconditions.checkNotNull(cls); if (!protoCodecMap.contains(cls)) { ProtoMessageCodec<T> codec = new ProtoMessageCodec<>(cls); protoCodecMap.putIfAbsent(cls, codec); } return (ProtoMessageCodec<T>) protoCodecMap.get(cls); }