java.util.LinkedHashMap.getOrDefault()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中java.util.LinkedHashMap.getOrDefault()方法的一些代码示例,展示了LinkedHashMap.getOrDefault()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedHashMap.getOrDefault()方法的具体详情如下:
包路径:java.util.LinkedHashMap
类名称:LinkedHashMap
方法名:getOrDefault

LinkedHashMap.getOrDefault介绍

暂无

代码示例

代码示例来源:origin: twosigma/beakerx

private boolean isCorrectEvent(Message message, CommActions commActions) {
 LinkedHashMap<String, LinkedHashMap> data = (LinkedHashMap) message.getContent().get("data");
 LinkedHashMap content = data.get("content");
 if (null != content && !content.isEmpty()) {
  String event = (String) content.getOrDefault("event", "");
  return commActions.getAction().equals(event);
 }
 return false;
}

代码示例来源:origin: pentaho/pentaho-kettle

List<Integer> coll = metaNameToIndex.getOrDefault( metaFieldNames[i], new ArrayList<>() );
coll.add( i );
metaNameToIndex.put( metaFieldNames[i], coll );

代码示例来源:origin: com.athaydes.rawhttp/rawhttp-core

/**
 * @param headerName case-insensitive header name
 * @return values for the header, or the empty list if this header is not present.
 */
public List<String> get(String headerName) {
  return headersByCapitalizedName.getOrDefault(
      toUppercaseAscii(headerName), NULL_HEADER).values;
}

代码示例来源:origin: renatoathaydes/rawhttp

/**
 * @param headerName case-insensitive header name
 * @return values for the header, or the empty list if this header is not present.
 */
public List<String> get(String headerName) {
  return headersByCapitalizedName.getOrDefault(
      toUppercaseAscii(headerName), NULL_HEADER).values;
}

代码示例来源:origin: com.ca.apim.gateway/gateway-export-plugin

@Override
public synchronized Object getOrDefault(Object key, Object defaultValue) {
  return propertyMap.getOrDefault(key, defaultValue);
}

代码示例来源:origin: BentoBoxWorld/BentoBox

/**
 * Get the rank value for this reference
 * @param reference - locale reference to the name of this rank
 * @return rank value or zero if this is an unknown rank
 */
public int getRankValue(String reference) {
  return ranks.getOrDefault(reference, VISITOR_RANK);
}

代码示例来源:origin: com.ca.apim.gateway/gateway-export-plugin

@Override
public String getProperty(String key, String defaultValue) {
  return (String) propertyMap.getOrDefault(key, defaultValue);
}

代码示例来源:origin: MER-C/wiki-java

/**
 *  Returns the namespace a page is in. There is no need to override this to
 *  add custom namespaces, though you may want to define static fields e.g.
 *  {@code public static final int PORTAL_NAMESPACE = 100;} for the Portal
 *  namespace on the English Wikipedia.
 *
 *  @param title any valid page name
 *  @return an integer representing the namespace of <var>title</var>
 *  @throws UncheckedIOException if the namespace cache has not been
 *  populated, and a network error occurs when populating it
 *  @see #namespaceIdentifier(int)
 *  @since 0.03
 */
public int namespace(String title)
{
  ensureNamespaceCache();
  // perform a limited normalization
  if (title.startsWith(":"))
    title = title.substring(1);
  if (!title.contains(":"))
    return MAIN_NAMESPACE;
  title = title.replace("_", " ");
  String namespace = title.substring(0, 1).toUpperCase(locale) + title.substring(1, title.indexOf(':'));
  return namespaces.getOrDefault(namespace, MAIN_NAMESPACE);
}

代码示例来源:origin: stackoverflow.com

Integer value = map.getOrDefault(key, 0) + 1;

代码示例来源:origin: anba/es6draft

} else if (languageTag.equals(likelySubtags.get(language))) {
  prio = 3;
} else if (likelySubtags.getOrDefault(language, "").startsWith(languageScript)) {
  prio = 4;
} else {

代码示例来源:origin: org.wildfly.core/wildfly-controller

AttributeParser ap = builder.attributeParsers.getOrDefault(adXmlName, ad.getParser());
if (ap != null && ap.isParseAsElement()) {
  attributeElements.put(ap.getXmlName(ad), ad);

代码示例来源:origin: wildfly/wildfly-core

AttributeParser ap = builder.attributeParsers.getOrDefault(adXmlName, ad.getParser());
if (ap != null && ap.isParseAsElement()) {
  attributeElements.put(ap.getXmlName(ad), ad);

代码示例来源:origin: USCDataScience/sparkler

public JBrowserDriver createBrowserInstance() {
  Integer socketTimeout = (Integer) pluginConfig.getOrDefault("socket.timeout", DEFAULT_TIMEOUT);
  Integer connectTimeout = (Integer) pluginConfig.getOrDefault("connect.timeout", DEFAULT_TIMEOUT);
  return new JBrowserDriver(Settings.builder()
      .timezone(Timezone.AMERICA_NEWYORK)
      .quickRender(true)
      .headless(true)
      .ignoreDialogs(true)
      .ajaxResourceTimeout(DEFAULT_TIMEOUT)
      .ajaxWait(DEFAULT_TIMEOUT).socketTimeout(socketTimeout)
      .connectTimeout(connectTimeout).build());
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

/**
 * Find DefinitonNode in module
 * @param path path of definition node
 * @param module module to search definition in
 */
private DefinitionNodeImpl findDefinitionNode(final JcrPath path, final ModuleImpl module) {
  for (ConfigDefinitionImpl configDefinition : module.getConfigDefinitions()) {
    final DefinitionNodeImpl definitionNode = configDefinition.getNode();
    if (path.equals(definitionNode.getJcrPath())) {
      return definitionNode;
    } else if (path.startsWith(definitionNode.getJcrPath())) {
      final JcrPath pathDiff = definitionNode.getJcrPath().relativize(path);
      DefinitionNodeImpl currentNode = configDefinition.getNode();
      for (final JcrPathSegment jcrPathSegment : pathDiff) {
        currentNode = currentNode.getModifiableNodes().getOrDefault(jcrPathSegment.toString(),
            currentNode.getModifiableNodes().get(jcrPathSegment.forceIndex().toString()));
        if (currentNode == null) {
          break; //wrong path
        } else if (currentNode.getJcrPath().equals(path)) {
          return currentNode;
        }
      }
    }
  }
  return null;
}

相关文章