Tabnine Logo
HashMap.merge
Code IndexAdd Tabnine to your IDE (free)

How to use
merge
method
in
java.util.HashMap

Best Java code snippets using java.util.HashMap.merge (Showing top 20 results out of 315)

origin: apache/storm

private HashMap<NodeInfo, Stream<TaskMessage>> groupBundleByDestination(Map<Integer, NodeInfo> taskToNode) {
  HashMap<NodeInfo, Stream<TaskMessage>> result = new HashMap<>();
  for (Entry<Integer, ArrayList<TaskMessage>> entry : bundles.entrySet()) {
    if (entry.getValue().isEmpty()) {
      continue;
    }
    NodeInfo node = taskToNode.get(entry.getKey());
    if (node != null) {
      result.merge(node, entry.getValue().stream(), Stream::concat);
    } else {
      LOG.warn("No remote destination available for task {}", entry.getKey());
    }
  }
  return result;
}
origin: com.typesafe.play/play

/**
 * @deprecated Deprecated as of 2.7.0. {@link Flash} will not be a subclass of {@link HashMap} in future Play releases.
 */
@Deprecated
@Override
public String merge(String key, String value, BiFunction<? super String, ? super String, ? extends String> remappingFunction) {
  return super.merge(key, value, remappingFunction);
}
origin: com.typesafe.play/play_2.12

/**
 * @deprecated Deprecated as of 2.7.0. {@link Session} will not be a subclass of {@link HashMap} in future Play releases.
 */
@Deprecated
@Override
public String merge(String key, String value, BiFunction<? super String, ? super String, ? extends String> remappingFunction) {
  return super.merge(key, value, remappingFunction);
}
origin: com.typesafe.play/play_2.11

/**
 * @deprecated Deprecated as of 2.7.0. {@link Session} will not be a subclass of {@link HashMap} in future Play releases.
 */
@Deprecated
@Override
public String merge(String key, String value, BiFunction<? super String, ? super String, ? extends String> remappingFunction) {
  return super.merge(key, value, remappingFunction);
}
origin: com.typesafe.play/play_2.12

/**
 * @deprecated Deprecated as of 2.7.0. {@link Flash} will not be a subclass of {@link HashMap} in future Play releases.
 */
@Deprecated
@Override
public String merge(String key, String value, BiFunction<? super String, ? super String, ? extends String> remappingFunction) {
  return super.merge(key, value, remappingFunction);
}
origin: com.typesafe.play/play_2.11

/**
 * @deprecated Deprecated as of 2.7.0. {@link Flash} will not be a subclass of {@link HashMap} in future Play releases.
 */
@Deprecated
@Override
public String merge(String key, String value, BiFunction<? super String, ? super String, ? extends String> remappingFunction) {
  return super.merge(key, value, remappingFunction);
}
origin: com.typesafe.play/play

/**
 * @deprecated Deprecated as of 2.7.0. {@link Session} will not be a subclass of {@link HashMap} in future Play releases.
 */
@Deprecated
@Override
public String merge(String key, String value, BiFunction<? super String, ? super String, ? extends String> remappingFunction) {
  return super.merge(key, value, remappingFunction);
}
origin: de.mhus.lib/mhu-lib-core

@Override
public String merge(String key, String value,
    BiFunction<? super String, ? super String, ? extends String> remappingFunction) {
  return map.merge(key, value, remappingFunction);
}
origin: de.mhus.lib/mhu-lib-core

@Override public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
  return map.merge(key, value, remappingFunction);
}
origin: Adobe-Consulting-Services/acs-aem-commons

private void trackMergeParameters(final HashMap<String, Set<String>> mapping, final String source,
String destination) {
mapping.merge(destination, new HashSet<>(), (a, b) -> a).add(source);
}

origin: org.jboss.da/reports-backend

@Override
public BinaryOperator<HashMap<Product, ProductArtifacts>> combiner() {
  return (h, m) -> {
    for(Map.Entry<Product, ProductArtifacts> e : m.entrySet()){
      h.merge(e.getKey(), e.getValue(), (a, b) -> new ProductArtifacts(e.getKey(), combineSets(a.getArtifacts(), b.getArtifacts())));
    }
    return h;
  };
}
origin: io.snamp/internal-services

@Override
public final V merge(final K key, final V value, final BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
  final V oldValue = get(key);
  final V newValue = super.merge(key, value, remappingFunction);
  //If value was changed after merge then mark this map as modified
  markAsModified(!Objects.equals(oldValue, newValue));
  return newValue;
}
origin: RS485/LogisticsPipes

private void updateContents() {
  _contentsMap.clear();
  _contentsUndamagedSet.clear();
  _contentsNoNBTSet.clear();
  _contentsUndamagedNoNBTSet.clear();
  for (ItemIdentifierStack _content : _contents) {
    if (_content == null) continue;
    ItemIdentifier itemId = _content.getItem();
    _contentsMap.merge(itemId, _content.getStackSize(), (a, b) -> a + b);
    _contentsUndamagedSet.add(itemId.getUndamaged()); // add is cheaper than check then add; it just returns false if it is already there
    _contentsNoNBTSet.add(itemId.getIgnoringNBT()); // add is cheaper than check then add; it just returns false if it is already there
    _contentsUndamagedNoNBTSet.add(itemId.getIgnoringNBT().getUndamaged()); // add is cheaper than check then add; it just returns false if it is already there
  }
}
origin: com.hotels.road/road-offramp-client

 public static Flux<Map<Integer, Long>> fromMessages(@NonNull Flux<Message<?>> messages, @NonNull Duration interval) {
  if (interval.toMillis() < 0L) {
   throw new IllegalArgumentException("Must not be a negative interval.");
  }
  return messages
    .window(interval)
    .<Map<Integer, Long>> flatMap(
      f -> f.collect(HashMap::new, (c, m) -> c.merge(m.getPartition(), m.getOffset() + 1L, Math::max)))
    .filter(x -> !x.isEmpty());
 }
}
origin: MegaMek/megamek

public HashMap<String, Integer> getSalvage(int era) {
  if (salvage.containsKey(era) && salvage.get(era).size() > 0) {
    return salvage.get(era);
  }
  HashMap<String,Integer> retVal = new HashMap<String, Integer>();
  if (retVal.size() == 0 && parentFactions.size() > 0) {
    for (String pKey : parentFactions) {
      FactionRecord fRec = RATGenerator.getInstance().getFaction(pKey);
      if (fRec != null) {
        for (String fKey : fRec.getSalvage(era).keySet()) {
          retVal.merge(fKey, fRec.getSalvage(era).get(fKey), Integer::sum);
        }                    
      } else {
        DefaultMmLogger.getInstance().debug(getClass(), "getSalvage(int)",
            "RATGenerator: could not locate salvage faction " + pKey
            + " for " + key);
      }
    }
  }
  salvage.put(era, retVal);
  return retVal;
}

origin: RS485/LogisticsPipes

addedItems.merge(next.getKey(), next.getValue(), (a, b) -> a + b);
origin: batfish/batfish

 @Override
 public Void visitShiftIpAddressIntoSubnet(
   ShiftIpAddressIntoSubnet shiftIpAddressIntoSubnet) {
  IpField ipField = shiftIpAddressIntoSubnet.getIpField();
  BDD bdd = getIpSpaceToBDD(ipField).toBDD(shiftIpAddressIntoSubnet.getSubnet());
  ranges.merge(ipField, bdd, BDD::or);
  return null;
 }
};
origin: CogComp/talen

counts.merge(new Pair<>(f.getLabel(), label), 1., (oldValue, one) -> oldValue + one);
featcounts.merge(f.getLabel(), 1, (oldValue, one) -> oldValue + one);
origin: org.jboss.da/reports-backend

@Override
public BiConsumer<HashMap<Product, ProductArtifacts>, Set<ProductArtifacts>> accumulator() {
  return (h, m) -> {
    for(ProductArtifacts pa : m){
      h.merge(pa.getProduct(), pa, (a, b) -> new ProductArtifacts(pa.getProduct(), combineSets(a.getArtifacts(), b.getArtifacts())));
    }
  };
}
origin: batfish/batfish

@Override
public Void visitAssignIpAddressFromPool(
  AssignIpAddressFromPool assignIpAddressFromPool) {
 IpField ipField = assignIpAddressFromPool.getIpField();
 BDDInteger var = getIpSpaceToBDD(ipField).getBDDInteger();
 BDD bdd =
   var.geq(assignIpAddressFromPool.getPoolStart().asLong())
     .and(var.leq(assignIpAddressFromPool.getPoolEnd().asLong()));
 ranges.merge(ipField, bdd, BDD::or);
 return null;
}
java.utilHashMapmerge

Popular methods of HashMap

  • <init>
    Constructs a new HashMap instance containing the mappings from the specified map.
  • put
    Maps the specified key to the specified value.
  • get
    Returns the value of the mapping with the specified key.
  • containsKey
    Returns whether this map contains the specified key.
  • keySet
    Returns a set of the keys contained in this map. The set is backed by this map so changes to one are
  • remove
  • entrySet
    Returns a set containing all of the mappings in this map. Each mapping is an instance of Map.Entry.
  • values
    Returns a collection of the values contained in this map. The collection is backed by this map so ch
  • size
    Returns the number of elements in this map.
  • clear
    Removes all mappings from this hash map, leaving it empty.
  • isEmpty
    Returns whether this map is empty.
  • putAll
    Copies all the mappings in the specified map to this map. These mappings will replace all mappings t
  • isEmpty,
  • putAll,
  • clone,
  • toString,
  • containsValue,
  • equals,
  • hashCode,
  • computeIfAbsent,
  • getOrDefault,
  • forEach

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
  • putExtra (Intent)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now