java.util.Properties.enumerateStringProperties()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(112)

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

Properties.enumerateStringProperties介绍

[英]Enumerates all key/value pairs in the specified hashtable and omits the property if the key or value is not a string.
[中]

代码示例

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

/**
 * Returns a set of keys in this property list where
 * the key and its corresponding value are strings,
 * including distinct keys in the default property list if a key
 * of the same name has not already been found from the main
 * properties list.  Properties whose key or value is not
 * of type <tt>String</tt> are omitted.
 * <p>
 * The returned set is not backed by the <tt>Properties</tt> object.
 * Changes to this <tt>Properties</tt> are not reflected in the set,
 * or vice versa.
 *
 * @return  a set of keys in this property list where
 *          the key and its corresponding value are strings,
 *          including the keys in the default property list.
 * @see     java.util.Properties#defaults
 * @since   1.6
 */
public Set<String> stringPropertyNames() {
  Hashtable<String, String> h = new Hashtable<>();
  enumerateStringProperties(h);
  return h.keySet();
}

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

/**
 * Returns a set of keys in this property list where
 * the key and its corresponding value are strings,
 * including distinct keys in the default property list if a key
 * of the same name has not already been found from the main
 * properties list.  Properties whose key or value is not
 * of type <tt>String</tt> are omitted.
 * <p>
 * The returned set is not backed by the <tt>Properties</tt> object.
 * Changes to this <tt>Properties</tt> are not reflected in the set,
 * or vice versa.
 *
 * @return  a set of keys in this property list where
 *          the key and its corresponding value are strings,
 *          including the keys in the default property list.
 * @see     java.util.Properties#defaults
 * @since   1.6
 */
public Set<String> stringPropertyNames() {
  Hashtable<String, String> h = new Hashtable<>();
  enumerateStringProperties(h);
  return h.keySet();
}

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

/**
 * Enumerates all key/value pairs in the specified hashtable
 * and omits the property if the key or value is not a string.
 * @param h the hashtable
 */
private synchronized void enumerateStringProperties(Hashtable<String, String> h) {
  if (defaults != null) {
    defaults.enumerateStringProperties(h);
  }
  for (Enumeration e = keys() ; e.hasMoreElements() ;) {
    Object k = e.nextElement();
    Object v = get(k);
    if (k instanceof String && v instanceof String) {
      h.put((String) k, (String) v);
    }
  }
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Returns a set of keys in this property list where
 * the key and its corresponding value are strings,
 * including distinct keys in the default property list if a key
 * of the same name has not already been found from the main
 * properties list.  Properties whose key or value is not
 * of type <tt>String</tt> are omitted.
 * <p>
 * The returned set is not backed by the <tt>Properties</tt> object.
 * Changes to this <tt>Properties</tt> are not reflected in the set,
 * or vice versa.
 *
 * @return  a set of keys in this property list where
 *          the key and its corresponding value are strings,
 *          including the keys in the default property list.
 * @see     java.util.Properties#defaults
 * @since   1.6
 */
public Set<String> stringPropertyNames()
{
  Hashtable<String, String> h= new Hashtable<String, String>();
  enumerateStringProperties(h);
  return h.keySet();
}

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

/**
 * Enumerates all key/value pairs in the specified hashtable
 * and omits the property if the key or value is not a string.
 * @param h the hashtable
 */
private synchronized void enumerateStringProperties(Hashtable<String, String> h) {
  if (defaults != null) {
    defaults.enumerateStringProperties(h);
  }
  for (Enumeration e = keys() ; e.hasMoreElements() ;) {
    Object k = e.nextElement();
    Object v = get(k);
    if (k instanceof String && v instanceof String) {
      h.put((String) k, (String) v);
    }
  }
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Enumerates all key/value pairs in the specified hashtable
 * and omits the property if the key or value is not a string.
 * @param h the hashtable
 */
private synchronized void enumerateStringProperties(Hashtable<String, String> h)
{
  if (defaults != null)
  {
    defaults.enumerateStringProperties(h);
  }
  for (Enumeration e= keys(); e.hasMoreElements();)
  {
    Object k= e.nextElement();
    Object v= get(k);
    if (k instanceof String && v instanceof String)
    {
      h.put((String) k, (String) v);
    }
  }
}

相关文章

微信公众号

最新文章

更多