java.util.IdentityHashMap.putAll()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(100)

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

IdentityHashMap.putAll介绍

[英]Copies all of the mappings from the specified map to this map. These mappings will replace any mappings that this map had for any of the keys currently in the specified map.
[中]将指定映射中的所有映射复制到此映射。这些映射将替换此映射对指定映射中当前任何键所具有的任何映射。

代码示例

代码示例来源:origin: facebook/stetho

public void commit() {
 if (!mIsUpdating) {
  throw new IllegalStateException();
 }
 // Apply the changes to the tree
 mElementToInfoMap.putAll(mElementToInfoChangesMap);
 // Remove garbage elements: those that have a null parent (other than mRootElement), and
 // their entire sub-trees, but excluding reparented elements.
 for (Object element : mRootElementChangesSet) {
  removeGarbageSubTree(mElementToInfoMap, element);
 }
 mIsUpdating = false;
 // Not usually enabled because it's expensive. Very useful for debugging.
 //validateTree(mElementToInfoMap);
}

代码示例来源:origin: apache/incubator-iceberg

@Override
public void putAll(Map<? extends TypeDescription, ? extends Integer> map) {
 idMap.putAll(map);
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

public void addResolvedNames(Map<Expression, Integer> mappings)
{
  resolvedNames.putAll(mappings);
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

public void addFunctionSignatures(IdentityHashMap<FunctionCall, Signature> infos)
{
  functionSignature.putAll(infos);
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

public void addTypes(IdentityHashMap<Expression, Type> types)
{
  this.types.putAll(types);
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

public void addCoercions(IdentityHashMap<Expression, Type> coercions)
{
  this.coercions.putAll(coercions);
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Constructs a new identity hash map containing the keys-value mappings
 * in the specified map.
 *
 * @param m the map whose mappings are to be placed into this map
 * @throws NullPointerException if the specified map is null
 */
public IdentityHashMap(Map<? extends K, ? extends V> m) {
  // Allow for a bit of growth
  this((int) ((1 + m.size()) * 1.1));
  putAll(m);
}

代码示例来源:origin: org.checkerframework/dataflow

/** Combine with another analysis result. */
public void combine(AnalysisResult<A, S> other) {
  nodeValues.putAll(other.nodeValues);
  mergeTreeLookup(treeLookup, other.treeLookup);
  unaryAssignNodeLookup.putAll(other.unaryAssignNodeLookup);
  stores.putAll(other.stores);
  finalLocalValues.putAll(other.finalLocalValues);
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Constructs a new identity hash map containing the keys-value mappings
 * in the specified map.
 *
 * @param m the map whose mappings are to be placed into this map
 * @throws NullPointerException if the specified map is null
 */
public IdentityHashMap(Map<? extends K, ? extends V> m) {
  // Allow for a bit of growth
  this((int) ((1 + m.size()) * 1.1));
  putAll(m);
}

代码示例来源:origin: org.checkerframework/dataflow

/** Set all current node values to the given map. */
/*package-private*/ void setNodeValues(IdentityHashMap<Node, A> in) {
  assert !isRunning;
  nodeValues.clear();
  nodeValues.putAll(in);
}

代码示例来源:origin: vmi/selenese-runner-java

/**
 * Constructs clone of DriverOptions.
 *
 * @param other other DriverOptions.
 */
public DriverOptions(DriverOptions other) {
  map.putAll(other.map);
  caps.merge(other.caps);
  cliArgs = other.cliArgs;
  chromeExtensions = other.chromeExtensions;
  envVars.putAll(other.envVars);
}

代码示例来源:origin: EvoSuite/evosuite

/**
 * Important to check what hooks are currently registered
 */
public void initHandler(){
  if(hooksReference == null){
    return; //
  }
  
  if(existingHooks != null){
    List<Thread> list = removeNewHooks();
    if(list!=null && !list.isEmpty()) {
      //only log if there were SUT hooks not executed
      logger.warn("Previous hooks were not executed. Going to remove them");
    }
  }
  
  existingHooks = new IdentityHashMap<>();
  existingHooks.putAll(hooksReference);
}

代码示例来源:origin: org.apache.kafka/connect-runtime

private synchronized void finishFailedFlush() {
  offsetWriter.cancelFlush();
  outstandingMessages.putAll(outstandingMessagesBacklog);
  outstandingMessagesBacklog.clear();
  flushing = false;
}

代码示例来源:origin: aria42/nlp-utils

public static <L>IdentityHashMap<ITree<L>, Span> getSpanMap(ITree<L> root, int start) {
 IdentityHashMap<ITree<L>,Span> res = new IdentityHashMap<ITree<L>,Span>();
 int newStart = start;
 for (ITree<L> child : root.getChildren()) {
  res.putAll(getSpanMap(child, newStart));
  newStart += Trees.getLeafYield(child).size();
 }
 res.put(root, new Span(start,newStart));
 return res;
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

deviceVersionAvailable.putAll(newDeviceVersionAvailable);
GLContext.setAvailableGLVersionsSet(toDevice, true);

代码示例来源:origin: org.jogamp.jogl/jogl

deviceVersionAvailable.putAll(newDeviceVersionAvailable);
GLContext.setAvailableGLVersionsSet(toDevice, true);

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

public static Object evaluateConstantExpression(Expression expression, Type expectedType, Metadata metadata, Session session)
{
  ExpressionAnalyzer analyzer = createConstantAnalyzer(metadata, session);
  analyzer.analyze(expression, new RelationType(), new AnalysisContext());
  Type actualType = analyzer.getExpressionTypes().get(expression);
  if (!canCoerce(actualType, expectedType)) {
    throw new SemanticException(SemanticErrorCode.TYPE_MISMATCH, expression, String.format("Cannot cast type %s to %s",
        expectedType.getTypeSignature(),
        actualType.getTypeSignature()));
  }
  IdentityHashMap<Expression, Type> coercions = new IdentityHashMap<>();
  coercions.putAll(analyzer.getExpressionCoercions());
  coercions.put(expression, expectedType);
  return evaluateConstantExpression(expression, coercions, metadata, session, ImmutableSet.of());
}

代码示例来源:origin: batfish/batfish

/**
 * Explain the flow space permitted by an {@link IpAccessList}. Along with the explanation is its
 * provenance: a map from each literal in the explanation to the set of ACL lines on which the
 * literal depends.
 */
public static AclLineMatchExprWithProvenance<IpAccessListLineIndex> explainWithProvenance(
  BDDPacket bddPacket,
  BDDSourceManager mgr,
  AclLineMatchExpr invariantExpr,
  IpAccessList acl,
  Map<String, IpAccessList> namedAcls,
  Map<String, IpSpace> namedIpSpaces) {
 checkArgument(
   namedAcls.getOrDefault(acl.getName(), acl).equals(acl),
   "namedAcls contains a different ACL with the same name as acl");
 IpAccessListToBDD ipAccessListToBDD =
   MemoizedIpAccessListToBDD.create(bddPacket, mgr, namedAcls, namedIpSpaces);
 // add the top-level acl to the list of named acls, because we are going to create
 // a new top-level acl to take into account the given invariant
 Map<String, IpAccessList> finalNamedAcls = new TreeMap<>(namedAcls);
 finalNamedAcls.putIfAbsent(acl.getName(), acl);
 IpAccessList aclWithInvariant = scopedAcl(invariantExpr, acl);
 IdentityHashMap<AclLineMatchExpr, IpAccessListLineIndex> literalsToLines =
   AclLineMatchExprLiterals.literalsToLines(finalNamedAcls.values());
 // add the newly created ACL's literals here to get provenance tracking for the
 // user-provided invariant as well
 literalsToLines.putAll(AclLineMatchExprLiterals.literalsToLines(aclWithInvariant));
 return explainWithProvenance(
   ipAccessListToBDD, aclWithInvariant, ImmutableMap.copyOf(finalNamedAcls), literalsToLines);
}

代码示例来源:origin: batfish/batfish

public static AclLineMatchExprWithProvenance<AclLineMatchExpr> explainNormalForm(
   AclLineMatchExpr nf) {
  /*
   * A normal form is either a factor or a disjunction of factors.
   */
  if (nf instanceof OrMatchExpr) {
   /*
    * Each disjunct is a factor.
    */
   SortedSet<AclLineMatchExprWithProvenance<AclLineMatchExpr>> disjunctsWithProvenance =
     ((OrMatchExpr) nf)
       .getDisjuncts().stream()
         .map(AclExplanation::explainFactor)
         .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural()));
   List<AclLineMatchExpr> disjuncts = new LinkedList<>();
   IdentityHashMap<AclLineMatchExpr, Set<AclLineMatchExpr>> provenance = new IdentityHashMap<>();
   for (AclLineMatchExprWithProvenance<AclLineMatchExpr> matchExprWithProvenance :
     disjunctsWithProvenance) {
    disjuncts.add(matchExprWithProvenance.getMatchExpr());
    provenance.putAll(matchExprWithProvenance.getProvenance());
   }
   return new AclLineMatchExprWithProvenance<>(new OrMatchExpr(disjuncts), provenance);
  }
  return explainFactor(nf);
 }
}

代码示例来源:origin: org.python/jython

pools[1] = toProcess;
toProcess = tmp;
pools[0].putAll(toProcess);
for (PyObject obj: toProcess.keySet()) {
  traverse(obj, ReachableFinder.defaultInstance, pools);

相关文章