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

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

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

Hashtable.<init>介绍

[英]Constructs a new Hashtable using the default capacity and load factor.
[中]使用默认容量和负载因子构造新的哈希表。

代码示例

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

/**
 * Undocumented method.  Do not use; internal-use only.
 *
 * @param name      the name of <code>$cflow</code> variable
 */
public Object[] lookupCflow(String name) {
  if (cflow == null)
    cflow = new Hashtable();
  return (Object[])cflow.get(name);
}

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

/**
 * Records the <code>$cflow</code> variable for the field specified
 * by <code>cname</code> and <code>fname</code>.
 *
 * @param name      variable name
 * @param cname     class name
 * @param fname     field name
 */
void recordCflow(String name, String cname, String fname) {
  if (cflow == null)
    cflow = new Hashtable();
  cflow.put(name, new Object[] { cname, fname });
}

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

private void addCDATAElement(String uri, String localName) 
{
  if (m_CdataElems == null) {
    m_CdataElems = new java.util.Hashtable();
  }
  
  java.util.Hashtable h = (java.util.Hashtable) m_CdataElems.get(localName);
  if (h == null) {
    h = new java.util.Hashtable();
    m_CdataElems.put(localName,h);
  }
  h.put(uri,uri);
  
}

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

/**
 * Create a new JNDI initial context. Invoked by {@link #execute}.
 * <p>The default implementation use this template's environment settings.
 * Can be subclassed for custom contexts, e.g. for testing.
 *
 * @return the initial Context instance
 * @throws NamingException in case of initialization errors
 */
@SuppressWarnings({"unchecked"})
protected Context createInitialContext() throws NamingException {
  Properties env = getEnvironment();
  Hashtable icEnv = null;
  if (env != null) {
    icEnv = new Hashtable(env.size());
    for (Enumeration en = env.propertyNames(); en.hasMoreElements();) {
      String key = (String) en.nextElement();
      icEnv.put(key, env.getProperty(key));
    }
  }
  return new InitialContext(icEnv);
}

代码示例来源:origin: Sable/soot

public Hashtable<Unit, Region> getUnit2RegionMap() {
 Hashtable<Unit, Region> unit2region = new Hashtable<Unit, Region>();
 List<Region> regions = this.getRegions();
 for (Iterator<Region> itr = regions.iterator(); itr.hasNext();) {
  Region r = itr.next();
  List<Unit> units = r.getUnits();
  for (Iterator<Unit> itr1 = units.iterator(); itr1.hasNext();) {
   Unit u = itr1.next();
   unit2region.put(u, r);
  }
 }
 return unit2region;
}

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

System.out.println("Purpose: authenticate user against Active Directory and list group membership.");
  System.out.println("Usage: App2 <username> <password> <domain> <server>");
  System.out.println("Short usage: App2 <username> <password>");
  System.out.println("(short usage assumes 'xyz.tld' as domain and 'abc' as server)");
  System.exit(1);
Hashtable props = new Hashtable();
String principalName = username + "@" + domainName;
props.put(Context.SECURITY_PRINCIPAL, principalName);
props.put(Context.SECURITY_CREDENTIALS, password);
DirContext context;
  System.out.println("User belongs to: ");
  Iterator ig = groups.iterator();
  while (ig.hasNext()) {
    System.out.println("   " + ig.next().toString());

代码示例来源:origin: Sable/soot

Hashtable nodeindex = new Hashtable(graph.size());
 while (nodesIt.hasNext()) {
  Object node = nodesIt.next();
while (nodesIt.hasNext()) {
 Object node = nodesIt.next();
 String nodeName = null;
 while (succsIt.hasNext()) {
  Object s = succsIt.next();
System.out.println("Drew main chain");
System.out.println("while printing, startToThread has size " + graph.getStartToThread().size());
Set maps = graph.getStartToThread().entrySet();
System.out.println("maps has size " + maps.size());
for (Iterator iter = maps.iterator(); iter.hasNext();) {
 Map.Entry entry = (Map.Entry) iter.next();

代码示例来源:origin: Sable/soot

public void addAll(WeightedDirectedSparseGraph othergraph) {
 WeightedDirectedSparseGraph another = othergraph;
 this.isUnknown = another.isUnknown;
 this.clear();
 Hashtable<Object, Hashtable<Object, IntContainer>> othersources = another.sources;
 Iterator<Object> othersrcIt = othersources.keySet().iterator();
 while (othersrcIt.hasNext()) {
  Object src = othersrcIt.next();
  Hashtable othertargets = othersources.get(src);
  Hashtable<Object, IntContainer> thistargets = new Hashtable<Object, IntContainer>(othersources.size());
  this.sources.put(src, thistargets);
  Iterator targetIt = othertargets.keySet().iterator();
  while (targetIt.hasNext()) {
   Object target = targetIt.next();
   IntContainer otherweight = (IntContainer) othertargets.get(target);
   thistargets.put(target, otherweight.dup());
  }
 }
}

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

/**
 * A test method.
 * @param args not used
 */
public static void main(String[] args) {
  try {
    Hashtable<String, String> hash = new Hashtable<>();
    hash.put("VERSION", "1.0.3");
    hash.put("b", "ffff");
    System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",
                      hash));
  } catch (Exception e) {
    e.printStackTrace(); //NOSONAR
  }
}

代码示例来源:origin: dermotte/LIRE

Hashtable<Integer, String> evalText = new Hashtable<Integer, String>(260);
for (int i = 0; i < readerQueries.maxDoc(); i++) {
  if (readerQueries.hasDeletions() && !liveDocs.get(i)) continue; // if it is deleted, just ignore it.
    evalText.put(query2id.get(fileName), tmpEval);
  fw.write(evalText.get(i + 1));
System.out.println(str);

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

b = bbuf.array();
} catch (CharacterCodingException e) {
  System.out.println(e.getMessage());
  com.google.zxing.Writer writer = new MultiFormatWriter();
  try {
    Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>(2);
    hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
    matrix = writer.encode(data,
    com.google.zxing.BarcodeFormat.QR_CODE, w, h, hints);
  } catch (com.google.zxing.WriterException e) {
    System.out.println(e.getMessage());
  try {
    MatrixToImageWriter.writeToFile(matrix, "PNG", file);
    System.out.println("printing to " + file.getAbsolutePath());
  } catch (IOException e) {
    System.out.println(e.getMessage());

代码示例来源:origin: jenkinsci/jenkins

/**
 * Cleans up any resources held by this classloader. Any open archive
 * files are closed.
 */
public synchronized void cleanup() {
  for (Enumeration e = jarFiles.elements(); e.hasMoreElements();) {
    JarFile jarFile = (JarFile) e.nextElement();
    try {
      jarFile.close();
    } catch (IOException ioe) {
      // ignore
    }
  }
  jarFiles = new Hashtable();
  if (project != null) {
    project.removeBuildListener(this);
  }
  project = null;
}

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

_namedTemplates = new Hashtable();
_neededTemplates = new Hashtable();
_templateIHs = new Hashtable();
_templateILs = new Hashtable();
_patternGroups = new Vector[32];
_rootPattern = null;
_templates = new Vector();
final Enumeration templates = oldTemplates.elements();
while (templates.hasMoreElements()) {
  final Template template = (Template)templates.nextElement();
  final int prec = template.getImportPrecedence();
  if ((prec >= min) && (prec < max)) addTemplate(template);

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

private AppletServer(ClassPool loader, StubGenerator gen, int port)
  throws IOException, NotFoundException, CannotCompileException
{
  super(port);
  exportedNames = new Hashtable();
  exportedObjects = new Vector();
  stubGen = gen;
  addTranslator(loader, gen);
}

代码示例来源:origin: TommyLemon/APIJSON

DecodeThread(CaptureActivity activity,
       Vector<BarcodeFormat> decodeFormats,
       String characterSet,
       ResultPointCallback resultPointCallback) {
 this.activity = activity;
 handlerInitLatch = new CountDownLatch(1);
 hints = new Hashtable<DecodeHintType, Object>(3);
 if (decodeFormats == null || decodeFormats.isEmpty()) {
    decodeFormats = new Vector<BarcodeFormat>();
    decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
    decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
    decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
 }
 
 hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
 if (characterSet != null) {
  hints.put(DecodeHintType.CHARACTER_SET, characterSet);
 }
 hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}

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

/**
 * This method starts at a given node, traverses all namespace mappings,
 * and assembles a list of all prefixes that (for the given node) maps
 * to _ANY_ namespace URI. Used by literal result elements to determine
 */
public Enumeration getNamespaceScope(SyntaxTreeNode node) {
Hashtable all = new Hashtable();

while (node != null) {
  Hashtable mapping = node.getPrefixMapping();
  if (mapping != null) {
  Enumeration prefixes = mapping.keys();
  while (prefixes.hasMoreElements()) {
    String prefix = (String)prefixes.nextElement();
    if (!all.containsKey(prefix)) {
    all.put(prefix, mapping.get(prefix));
    }
  }
  }
  node = node.getParent();
}
return(all.keys());
}

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

protected ActiveMQConnectionFactory createConnectionFactory(String name, Hashtable environment) throws URISyntaxException {
  Hashtable temp = new Hashtable(environment);
  if (DEFAULT_CONNECTION_FACTORY_NAMES[1].equals(name)) {
    // don't try to mod environment, it may be readonly
    temp.put("xa", String.valueOf(true));
  }
  String prefix = connectionPrefix + name + ".";
  for (Iterator iter = environment.entrySet().iterator(); iter.hasNext();) {
    Map.Entry entry = (Map.Entry)iter.next();
    String key = (String)entry.getKey();
    if (key.startsWith(prefix)) {
      // Rename the key...
      temp.remove(key);
      key = key.substring(prefix.length());
      temp.put(key, entry.getValue());
    }
  }
  return createConnectionFactory(temp);
}

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

mb = connector.getMBeanServerConnection();
Hashtable<String, String> pairs = new Hashtable<>();
pairs.put("service", "HBase");
pairs.put("name", "Master");
pairs.put("sub", "Balancer");
target = new ObjectName("Hadoop", pairs);
MBeanInfo beanInfo = mb.getMBeanInfo(target);
 Set<ObjectInstance> instances = mb.queryMBeans(null, null);
 Iterator<ObjectInstance> iterator = instances.iterator();
 System.out.println("MBean Found:");
 while (iterator.hasNext()) {
  ObjectInstance instance = iterator.next();
  System.out.println("Class Name: " + instance.getClassName());
  System.out.println("Object Name: " + instance.getObjectName());

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

protected Map allSchemas = new Hashtable();
   while(importsIterator.hasNext())
      System.out.println("Retrieving schema at '" + 
                schemaRef.getSchemaLocationURI() +
               (schema.getDocumentBaseURI() == null

代码示例来源:origin: Sable/soot

public void addBoundedAll(WeightedDirectedSparseGraph another) {
 this.isUnknown = another.isUnknown;
 Hashtable<Object, Hashtable<Object, IntContainer>> othersources = another.sources;
 Iterator thisnodeIt = this.vertexes.iterator();
 while (thisnodeIt.hasNext()) {
  Object src = thisnodeIt.next();
  Hashtable othertargets = othersources.get(src);
  if (othertargets == null) {
   continue;
  }
  Hashtable<Object, IntContainer> thistargets = new Hashtable<Object, IntContainer>();
  Iterator othertargetIt = othertargets.keySet().iterator();
  while (othertargetIt.hasNext()) {
   Object key = othertargetIt.next();
   if (this.vertexes.contains(key)) {
    IntContainer weight = (IntContainer) othertargets.get(key);
    thistargets.put(key, weight.dup());
   }
  }
  if (thistargets.size() > 0) {
   this.sources.put(src, thistargets);
  }
 }
}

相关文章