当前位置: 首页>>代码示例>>Java>>正文


Java Hashtable.keys方法代码示例

本文整理汇总了Java中java.util.Hashtable.keys方法的典型用法代码示例。如果您正苦于以下问题:Java Hashtable.keys方法的具体用法?Java Hashtable.keys怎么用?Java Hashtable.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Hashtable的用法示例。


在下文中一共展示了Hashtable.keys方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clone

import java.util.Hashtable; //导入方法依赖的package包/类
public Object clone() {
    ArrayTable newArrayTable = new ArrayTable();
    if (isArray()) {
        Object[] array = (Object[])table;
        for (int i = 0 ;i < array.length-1 ; i+=2) {
            newArrayTable.put(array[i], array[i+1]);
        }
    } else {
        Hashtable<?,?> tmp = (Hashtable)table;
        Enumeration<?> keys = tmp.keys();
        while (keys.hasMoreElements()) {
            Object o = keys.nextElement();
            newArrayTable.put(o,tmp.get(o));
        }
    }
    return newArrayTable;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ArrayTable.java

示例2: PolicyMappings

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Creates a new <code>PolicyMappings</code> instance.
 *
 * @param mappings a <code>HashMap</code> value that maps
 *                 <code>String</code> oids
 *                 to other <code>String</code> oids.
 * @deprecated use CertPolicyId constructors.
 */
public PolicyMappings(Hashtable mappings)
{
    ASN1EncodableVector dev = new ASN1EncodableVector();
    Enumeration it = mappings.keys();

    while (it.hasMoreElements())
    {
        String idp = (String)it.nextElement();
        String sdp = (String)mappings.get(idp);
        ASN1EncodableVector dv = new ASN1EncodableVector();
        dv.add(new ASN1ObjectIdentifier(idp));
        dv.add(new ASN1ObjectIdentifier(sdp));
        dev.add(new DERSequence(dv));
    }

    seq = new DERSequence(dev);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:26,代码来源:PolicyMappings.java

示例3: unregisterWithKeyboardManager

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Unregisters all the previously registered
 * <code>WHEN_IN_FOCUSED_WINDOW</code> <code>KeyStroke</code> bindings.
 */
private void unregisterWithKeyboardManager() {
    Hashtable<KeyStroke, KeyStroke> registered =
            (Hashtable<KeyStroke, KeyStroke>)getClientProperty
                            (WHEN_IN_FOCUSED_WINDOW_BINDINGS);

    if (registered != null && registered.size() > 0) {
        Enumeration<KeyStroke> keys = registered.keys();

        while (keys.hasMoreElements()) {
            KeyStroke ks = keys.nextElement();
            unregisterWithKeyboardManager(ks);
        }
    }
    putClientProperty(WHEN_IN_FOCUSED_WINDOW_BINDINGS, null);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:JComponent.java

示例4: getPostInput

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Gets a string for input to a POST cgi script
 *
 * @param  params   Hashtable of query parameters to be passed to
 *                  the CGI script
 * @return          for use as input to the CGI script
 */

protected String getPostInput(Hashtable params) {
    String lineSeparator = System.getProperty("line.separator");
    Enumeration paramNames = params.keys();
    StringBuffer postInput = new StringBuffer("");
    StringBuffer qs = new StringBuffer("");
    if (paramNames != null && paramNames.hasMoreElements()) {
        while (paramNames.hasMoreElements()) {
            String k = (String) paramNames.nextElement();
            String v = params.get(k).toString();
            if ((k.indexOf("=") < 0) && (v.indexOf("=") < 0)) {
                postInput.append(k);
                qs.append(k);
                postInput.append("=");
                qs.append("=");
                postInput.append(v);
                qs.append(v);
                postInput.append(lineSeparator);
                qs.append("&");
            }
        }
    }
    qs.append(lineSeparator);
    return qs.append(postInput).toString();
}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:33,代码来源:CGIServlet.java

示例5: doCreateInstance

import java.util.Hashtable; //导入方法依赖的package包/类
protected static Integer doCreateInstance(String s, Hashtable<String, Integer> stringMap, Hashtable<Integer, String> intMap) {
    if (s == null)
        return null;

    String sx = s.toLowerCase();
    Enumeration<String> enS = stringMap.keys();
    while (enS.hasMoreElements()) {
        String s1 = enS.nextElement();
        if (s1.toLowerCase().equals(sx)) {
            return stringMap.get(s1);
        }
    }

    try {
        int i2 = Integer.parseInt(s);
        Enumeration<Integer> enI = intMap.keys();
        while (enI.hasMoreElements()) {
            int i1 = enI.nextElement();
            if (i1 == i2) {
                return i1;
            }
        }
    } catch (Exception e) {

    }

    return null;
}
 
开发者ID:RestComm,项目名称:phone-simulator,代码行数:29,代码来源:EnumeratedBase.java

示例6: X509Extensions

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Constructor from a table of extensions with ordering.
 * <p>
 * It's is assumed the table contains OID/String pairs.
 * @deprecated use Extensions
 */
public X509Extensions(
    Vector      ordering,
    Hashtable   extensions)
{
    Enumeration e;

    if (ordering == null)
    {
        e = extensions.keys();
    }
    else
    {
        e = ordering.elements();
    }

    while (e.hasMoreElements())
    {
        this.ordering.addElement(ASN1ObjectIdentifier.getInstance(e.nextElement()));
    }

    e = this.ordering.elements();

    while (e.hasMoreElements())
    {
        ASN1ObjectIdentifier     oid = ASN1ObjectIdentifier.getInstance(e.nextElement());
        X509Extension           ext = (X509Extension)extensions.get(oid);

        this.extensions.put(oid, ext);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:37,代码来源:X509Extensions.java

示例7: SwitchDataEnumeration

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Create a new enumeration from the hashtable.  Each key in the
 * hash table will be an Integer, with the value being a label.  The
 * enumeration returns the keys in sorted order.
 */
SwitchDataEnumeration(Hashtable<Integer,Label> tab) {
    table = new Integer[tab.size()];
    int i = 0;
    for (Enumeration<Integer> e = tab.keys() ; e.hasMoreElements() ; ) {
        table[i++] = e.nextElement();
    }
    Arrays.sort(table);
    current_index = 0;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:SwitchData.java

示例8: hashToStringArray

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Converts a Hashtable to a String array by converting each
 * key/value pair in the Hashtable to a String in the form
 * "key=value" (hashkey + "=" + hash.get(hashkey).toString())
 *
 * @param  h   Hashtable to convert
 *
 * @return     converted string array
 *
 * @exception  NullPointerException   if a hash key has a null value
 *
 */
protected String[] hashToStringArray(Hashtable<String,?> h)
    throws NullPointerException {
    Vector<String> v = new Vector<String>();
    Enumeration<String> e = h.keys();
    while (e.hasMoreElements()) {
        String k = e.nextElement();
        v.add(k + "=" + h.get(k).toString());
    }
    String[] strArr = new String[v.size()];
    v.copyInto(strArr);
    return strArr;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:CGIServlet.java

示例9: findAttrNamesForOID

import java.util.Hashtable; //导入方法依赖的package包/类
public static String[] findAttrNamesForOID(
    ASN1ObjectIdentifier oid,
    Hashtable            lookup)
{
    int count = 0;
    for (Enumeration en = lookup.elements(); en.hasMoreElements();)
    {
        if (oid.equals(en.nextElement()))
        {
            count++;
        }
    }

    String[] aliases = new String[count];
    count = 0;

    for (Enumeration en = lookup.keys(); en.hasMoreElements();)
    {
        String key = (String)en.nextElement();
        if (oid.equals(lookup.get(key)))
        {
            aliases[count++] = key;
        }
    }

    return aliases;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:28,代码来源:IETFUtils.java

示例10: hashToStringArray

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Converts a Hashtable to a String array by converting each
 * key/value pair in the Hashtable to a String in the form
 * "key=value" (hashkey + "=" + hash.get(hashkey).toString())
 *
 * @param  h   Hashtable to convert
 *
 * @return     converted string array
 *
 * @exception  NullPointerException   if a hash key has a null value
 *
 */
protected String[] hashToStringArray(Hashtable h)
    throws NullPointerException {
    Vector v = new Vector();
    Enumeration e = h.keys();
    while (e.hasMoreElements()) {
        String k = e.nextElement().toString();
        v.add(k + "=" + h.get(k));
    }
    String[] strArr = new String[v.size()];
    v.copyInto(strArr);
    return strArr;
}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:25,代码来源:CGIServlet.java

示例11: matchesAdditionalGeneratedPath

import java.util.Hashtable; //导入方法依赖的package包/类
public Vector<String> matchesAdditionalGeneratedPath(String fullPath) {
    Vector<String> rv = new Vector<String>();
    Hashtable<String, String> v = (Hashtable<String, String>)BuildConfig.getField(this.toString(), "AdditionalGeneratedFile");
    if (v != null) {
        for (Enumeration<String> e=v.keys(); e.hasMoreElements(); ) {
            String key = e.nextElement();
            String val = v.get(key);

            if (fullPath.endsWith(expandFormat(key))) {
                rv.add(expandFormat(val));
            }
        }
    }
    return rv;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:16,代码来源:BuildConfig.java

示例12: getAvailableFormatsList

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 *  Gets all possible metadata formats that are available for a given ID.
 *
 * @param  id  The id for the record.
 * @return     The metadataFormats available.
 */
public List getAvailableFormatsList(String id) {
	Hashtable formats = getAvailableFormats(id);
	List fmts = new ArrayList(formats.size());
	Enumeration enumeration = formats.keys();

	while (enumeration.hasMoreElements())
		fmts.add(enumeration.nextElement());
	return fmts;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:16,代码来源:RepositoryManager.java

示例13: entest3

import java.util.Hashtable; //导入方法依赖的package包/类
static void entest3(Hashtable ht, int size) {
  int sum = 0;

  timer.start("Iterf Enumeration Key  ", size);
  Enumeration en = ht.keys();
  for (int i = 0; i < size; ++i) {
    if (en.nextElement() != MISSING)
      ++sum;
  }
  timer.finish();
  reallyAssert(sum == size);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:13,代码来源:IntMapCheckJUnitTest.java

示例14: toString

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 *  Expresa la tabla en texto
 *
 *@return    Texto con la tabla de estados
 */
public String toString()
{
	String dev = "LEYENDA:   Estado: input/accion -> estado siguiente";
	dev += "\n------------------------------------------------------";
	java.util.Enumeration nombres = clasificacionEstados.keys();

	String input = "";
	String accion = "";
	String estsig = "";
	String id = "";
	while (nombres.hasMoreElements())
	{
		id = (String) nombres.nextElement();

		Hashtable inp = (Hashtable) inputsDeEstados.get(id);
		if (!inp.isEmpty())
		{
			java.util.Enumeration inps = inp.keys();
			while (inps.hasMoreElements())
			{
				input = (String) inps.nextElement();
				Operacion op = (Operacion) inp.get(input);
				accion = op.accionSemantica;
				estsig = op.estadoSiguiente;
				dev += "\n" + id + ": " + input + " / " + accion + " -> " + estsig;
			}

		}
		else
		{
			dev += "\n" + id + " <- ES UN ESTADO FINAL";
		}

	}
	return dev += "\n------------------------------------------------------";
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:42,代码来源:TablaEstadosControl.java

示例15: writeEnvironmentReport

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Dump a basic Xalan environment report to outWriter.
 *
 * <p>This dumps a simple header and then each of the entries in
 * the Hashtable to our PrintWriter; it does special processing
 * for entries that are .jars found in the classpath.</p>
 *
 * @param h Hashtable of items to report on; presumably
 * filled in by our various check*() methods
 * @return true if your environment appears to have no major
 * problems; false if potential environment problems found
 * @see #appendEnvironmentReport(Node, Document, Hashtable)
 * for an equivalent that appends to a Node instead
 */
protected boolean writeEnvironmentReport(Hashtable h)
{

  if (null == h)
  {
    logMsg("# ERROR: writeEnvironmentReport called with null Hashtable");
    return false;
  }

  boolean errors = false;

  logMsg(
    "#---- BEGIN writeEnvironmentReport($Revision: 1.10 $): Useful stuff found: ----");

  // Fake the Properties-like output
  for (Enumeration keys = h.keys();
       keys.hasMoreElements();
      /* no increment portion */
      )
  {
    Object key = keys.nextElement();
    String keyStr = (String) key;
    try
    {
      // Special processing for classes found..
      if (keyStr.startsWith(FOUNDCLASSES))
      {
        Vector v = (Vector) h.get(keyStr);
        errors |= logFoundJars(v, keyStr);
      }
      // ..normal processing for all other entries
      else
      {
        // Note: we could just check for the ERROR key by itself,
        //    since we now set that, but since we have to go
        //    through the whole hash anyway, do it this way,
        //    which is safer for maintenance
        if (keyStr.startsWith(ERROR))
        {
          errors = true;
        }
        logMsg(keyStr + "=" + h.get(keyStr));
      }
    }
    catch (Exception e)
    {
      logMsg("Reading-" + key + "= threw: " + e.toString());
    }
  }

  logMsg(
    "#----- END writeEnvironmentReport: Useful properties found: -----");

  return errors;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:70,代码来源:EnvironmentCheck.java


注:本文中的java.util.Hashtable.keys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。