com.carrotsearch.hppc.ObjectIntHashMap.putOrAdd()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(78)

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

ObjectIntHashMap.putOrAdd介绍

[英]If key exists, putValue is inserted into the map, otherwise any existing value is incremented by additionValue.
[中]如果存在key,则将putValue插入到映射中,否则任何现有值将增加additionValue

代码示例

代码示例来源:origin: carrotsearch/hppc

/**
 * Adds <code>incrementValue</code> to any existing value for the given <code>key</code>
 * or inserts <code>incrementValue</code> if <code>key</code> did not previously exist.
 * 
 * @param key The key of the value to adjust.
 * @param incrementValue The value to put or add to the existing value if <code>key</code> exists.
 * @return Returns the current value associated with <code>key</code> (after changes).
 */
@Override
public int addTo(KType key, int incrementValue)
{
 return putOrAdd(key, incrementValue, incrementValue);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Adds <code>incrementValue</code> to any existing value for the given <code>key</code>
 * or inserts <code>incrementValue</code> if <code>key</code> did not previously exist.
 * 
 * @param key The key of the value to adjust.
 * @param incrementValue The value to put or add to the existing value if <code>key</code> exists.
 * @return Returns the current value associated with <code>key</code> (after changes).
 */
@Override
public int addTo(KType key, int incrementValue)
{
 return putOrAdd(key, incrementValue, incrementValue);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

if (!node.nodeId().equals(nodeId)) {
  shardPerAttribute.putOrAdd(allocation.routingNodes().node(nodeId).node().getAttributes().get(awarenessAttribute),
      0, -1);
  shardPerAttribute.addTo(node.node().getAttributes().get(awarenessAttribute), 1);

代码示例来源:origin: dremio/dremio-oss

final int maxWidth = endpointAffinity.getMaxWidth();
final double affinity = endpointAffinity.getAffinity();
maxWidthPerNode.putOrAdd(endpoint, maxWidth, maxWidth);
affinityPerNode.putOrAdd(endpoint, affinity, affinity);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

if (!node.nodeId().equals(nodeId)) {
  shardPerAttribute.putOrAdd(allocation.routingNodes().node(nodeId).node().getAttributes().get(awarenessAttribute),
      0, -1);
  shardPerAttribute.addTo(node.node().getAttributes().get(awarenessAttribute), 1);

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

if (!node.nodeId().equals(nodeId)) {
  shardPerAttribute.putOrAdd(allocation.routingNodes().node(nodeId).node().getAttributes().get(awarenessAttribute),
      0, -1);
  shardPerAttribute.addTo(node.node().getAttributes().get(awarenessAttribute), 1);

代码示例来源:origin: apache/servicemix-bundles

if (!node.nodeId().equals(nodeId)) {
  shardPerAttribute.putOrAdd(allocation.routingNodes().node(nodeId).node().getAttributes().get(awarenessAttribute),
      0, -1);
  shardPerAttribute.addTo(node.node().getAttributes().get(awarenessAttribute), 1);

代码示例来源:origin: harbby/presto-connectors

if (!node.nodeId().equals(nodeId)) {
  shardPerAttribute.putOrAdd(allocation.routingNodes().node(nodeId).node().attributes().get(awarenessAttribute), 0, -1);
  shardPerAttribute.addTo(node.node().attributes().get(awarenessAttribute), 1);

相关文章