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

x33g5p2x  于2022-01-19 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(139)

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

Hashtable.putAll介绍

[英]Copies every mapping to this Hashtable from the specified map.
[中]将每个映射从指定映射复制到此哈希表。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a new naming context with the given naming root,
 * the given name/object map, and the JNDI environment entries.
 */
public SimpleNamingContext(
    String root, Hashtable<String, Object> boundObjects, @Nullable Hashtable<String, Object> env) {
  this.root = root;
  this.boundObjects = boundObjects;
  if (env != null) {
    this.environment.putAll(env);
  }
}

代码示例来源:origin: scouter-project/scouter

public void putAll(Map<String, Value> m){
    this.table.putAll(m);
  }
}

代码示例来源:origin: scouter-project/scouter

public void putAll(Map<String, Value> m){
    this.table.putAll(m);
  }
}

代码示例来源:origin: scouter-project/scouter

public void putAll(Map<String, Value> m){
    this.table.putAll(m);
  }
}

代码示例来源:origin: scouter-project/scouter

public void putAll(Map<String, Value> m){
    this.table.putAll(m);
  }
}

代码示例来源:origin: scouter-project/scouter

public void putAll(Map<String, Value> m){
    this.table.putAll(m);
  }
}

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

Properties merged = new Properties();
merged.putAll(properties1);
merged.putAll(properties2);

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a new naming context with the given naming root,
 * the given name/object map, and the JNDI environment entries.
 */
public SimpleNamingContext(
    String root, Hashtable<String, Object> boundObjects, @Nullable Hashtable<String, Object> env) {
  this.root = root;
  this.boundObjects = boundObjects;
  if (env != null) {
    this.environment.putAll(env);
  }
}

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

Map<String, String> map = new LinkedHashMap<String, String>();
map.put("key", "value");

Properties properties = new Properties();
properties.putAll(map);

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

Properties properties = new Properties();

properties.load(new FileInputStream("file1.properties"));

Properties properties2 = new Properties();
properties2.load(new FileInputStream("file2.properties"));

properties.putAll(properties2);

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

Properties tmp = new Properties() {
  @Override
  public synchronized Enumeration<Object> keys() {
    return Collections.enumeration(new TreeSet<Object>(super.keySet()));
  }
};
tmp.putAll(properties);
tmp.store(new FileWriter(file), null);

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

String propFile = "/path/to/file";
Properties props = new Properties();
/*set some properties here*/
Properties tmp = new Properties() {

 @Override
 public Set<Object> keySet()
 {
  return Collections.unmodifiableSet(new TreeSet<Object>(super.keySet()));
 }

};
tmp.putAll(props);
try {
  FileOutputStream xmlStream = new FileOutputStream(propFile);
  /*this comes out SORTED! */
  tmp.storeToXML(xmlStream,"");
} catch (IOException e) {
  e.printStackTrace();
}

代码示例来源:origin: apache/shiro

env.putAll(additionalEnvironment);

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

public static Bundle bundleWithHeaders(Map headerMap, String symbolicName) {
  Bundle bundle = mock(Bundle.class);
  Hashtable<String, String> headers = new Hashtable<>();
  headers.putAll(headerMap);
  when(bundle.getHeaders()).thenReturn(headers);
  when(bundle.getSymbolicName()).thenReturn(symbolicName);
  return bundle;
}

代码示例来源:origin: spring-projects/spring-security

private DirContext bindAsUser(String username, String password) {
  // TODO. add DNS lookup based on domain
  final String bindUrl = url;
  Hashtable<String, Object> env = new Hashtable<>();
  env.put(Context.SECURITY_AUTHENTICATION, "simple");
  String bindPrincipal = createBindPrincipal(username);
  env.put(Context.SECURITY_PRINCIPAL, bindPrincipal);
  env.put(Context.PROVIDER_URL, bindUrl);
  env.put(Context.SECURITY_CREDENTIALS, password);
  env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
  env.put(Context.OBJECT_FACTORIES, DefaultDirObjectFactory.class.getName());
  env.putAll(this.contextEnvironmentProperties);
  try {
    return contextFactory.createContext(env);
  }
  catch (NamingException e) {
    if ((e instanceof AuthenticationException)
        || (e instanceof OperationNotSupportedException)) {
      handleBindException(bindPrincipal, e);
      throw badCredentials(e);
    }
    else {
      throw LdapUtils.convertLdapException(e);
    }
  }
}

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

readOnlyContexts.putAll(myLock);

代码示例来源:origin: org.apache.ant/ant

files.putAll(genfiles);

代码示例来源:origin: org.apache.ant/ant

allProps.putAll(getProject().getProperties());
} else if (inFile != null) {
  if (inFile.isDirectory()) {
    Properties props = new Properties();
    props.load(in);
    allProps.putAll(props);
  } catch (FileNotFoundException fnfe) {
    String message =

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

consts.putAll(fragment.getConsts());
uniforms.putAll(fragment.getUniforms());
attributes.putAll(fragment.getAttributes());
varyings.putAll(fragment.getVaryings());
globals.putAll(fragment.getGlobals());

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

Properties master = new Properties();
master.load(masterInput);

Properties moduleA = new Properties();
moduleA.load(moduleAinput);
master.putAll(moduleA);

Properties moduleB = new Properties();
moduleB.load(moduleBinput);
master.putAll(moduleB);

// Now `master` contains the properties of all files.

相关文章