jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Property File Iteration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Property File Iteration" Watch "Property File Iteration" New topic

Property File Iteration

Alan Sperling

Joined: May 21, 2004
Posts: 2
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,
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 805
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.

Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Alan Sperling

Joined: May 21, 2004
Posts: 2
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.

I agree. Here's the link: http://aspose.com/file-tools
subject: Property File Iteration
It's not a secret anymore!