Java遍历Properties
来源:互联网 发布:叶子节点算法 编辑:程序博客网 时间:2024/06/15 22:29
如代码所示
/** * */package pkg;import java.util.Enumeration;import java.util.Iterator;import java.util.Map.Entry;import java.util.Properties;/** * @author qefee * */public class ShowProperties {/** * @param args */public static void main(String[] args) {Properties properties = System.getProperties();// show keysshowKeys(properties);// show valuesshowValues(properties);// show keys and valuesshowKeysAndValues(properties);}/** * @param properties */private static void showKeys(Properties properties) {Enumeration<?> enu = properties.propertyNames();while (enu.hasMoreElements()) {Object key = enu.nextElement();System.out.println(key);}}/** * @param properties */private static void showValues(Properties properties) {Enumeration<Object> enu = properties.elements();while (enu.hasMoreElements()) {Object value = enu.nextElement();System.out.println(value);}}/** * @param properties */private static void showKeysAndValues(Properties properties) {Iterator<Entry<Object, Object>> it = properties.entrySet().iterator();while (it.hasNext()) {Entry<Object, Object> entry = it.next();Object key = entry.getKey();Object value = entry.getValue();System.out.println("key :" + key);System.out.println("value :" + value);System.out.println("---------------");}}}
相关链接
http://blog.csdn.net/daryl715/article/details/1802204
- Java遍历Properties
- java遍历Properties文件
- Java遍历Properties
- Java遍历Properties
- Java遍历Properties
- Java 中Map 和 Properties 的遍历
- java如何读取和遍历properties文件
- java遍历Properties并排序输出
- 【Java编程】写入、读取、遍历Properties文件
- 【Java编程】写入、读取、遍历Properties文件
- Java properties存储与读取遍历
- 【Java编程】写入、读取、遍历Properties文件
- java加载并遍历properties文件
- Java基础-加载和遍历.properties文件
- Java如何遍历Properties的所有的元素
- Java如何遍历Properties的所有的元素
- java中遍历properties属性文件的方法
- java如何读取和遍历properties文件
- 创造属于自己的注册码
- linux 错误处理小结
- Cache Fusion (1)
- 16.5.2 并发访问邮箱
- 为什么回家还是不高兴呢
- Java遍历Properties
- mpeg 官网 代码 和分析
- 我的 OLAP 分析三
- Linux-world-2012-January->15(为了自勉的纪念--缅怀dmr)
- blog list
- mmap函数用法及示例程序
- 文字垂直居中
- 平台总线设备模型
- 某日,女秘书神色凝重地说:王总,我怀孕了。 王继续低头看文件,然后...