Tuesday, December 27, 2011

Display all key-values in a Properties object


<< Previous Table of Categories Next >>


 
 /**
   * Feel free to copy and use this. 
   * If you have any comments or better solutions, please paste on my blog: 
   * http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com 
   */ 
  public static void displayAll(Properties properties)
  { 
    Enumeration keysEnum = properties.keys();
    while(keysEnum.hasMoreElements())
    {
      String key=(String)keysEnum.nextElement();
      System.out.println(key+"="+properties.getProperty(key));
     }
   }
 }

No comments:

Post a Comment