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; }
/** * @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); }
/** * @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); }
/** * @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); }
/** * @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); }
/** * @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); }
/** * @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); }
@Override public String merge(String key, String value, BiFunction<? super String, ? super String, ? extends String> remappingFunction) { return map.merge(key, value, remappingFunction); }
@Override public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) { return map.merge(key, value, remappingFunction); }
private void trackMergeParameters(final HashMap<String, Set<String>> mapping, final String source, String destination) { mapping.merge(destination, new HashSet<>(), (a, b) -> a).add(source); }
@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; }; }
@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; }
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 } }
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()); } }
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; }
addedItems.merge(next.getKey(), next.getValue(), (a, b) -> a + b);
@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; } };
@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()))); } }; }
@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; }