Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Property File Iteration

 
Alan Sperling
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm trying to get a list of the key/value pairs in a property file without using the java.util.Properities.list() method. I'd like to iterate over the key/value pairs using an iterator object, but haven't figured out the right combination of objects to use. Can someone point me in the right direction. This is what I have thus far:


Thanks for any help,
Alan
 
Jeff Bosch
Ranch Hand
Posts: 805
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would consider using the split method of the String class, then interating over the resulting array, using the even index elements for the key and the odd index elements for the value.
 
Alan Sperling
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please excuse the caos, my first time posting on JavaRanch and thought the code blocks would handle my code better than it looked in text mode.

Here's a cleaned up version - hopefully.


Alan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic