aspose file tools*
The moose likes Java in General and the fly likes Read duplicate keys from properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Read duplicate keys from properties file" Watch "Read duplicate keys from properties file" New topic
Author

Read duplicate keys from properties file

Robin Sharma
Ranch Hand

Joined: Aug 24, 2005
Posts: 76
How to read duplicate keys from a properties file.

Thanks.


DW
There is always a bug :-)
ak pillai
author
Ranch Hand

Joined: Feb 11, 2006
Posts: 288
The properies file cannot have duplicate keys. you can have array of values returned for a supplied key.



the above key1 can return array of values.


java j2ee job interview questions with answers | Learn the core concepts and the key areas
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
If you really want to do something along these lines, you'll have to write the code to read (and perhaps write) the "properties" file yourself. This can be fairly simple, actually. And you'd need some sort of data structure which allows multiple values for a given key - Properties doesn't. You may want to look at org.apache.commons.collections.MultiMap for example. Or use an array for the value, as ak suggests.
[ March 13, 2006: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
 
 
subject: Read duplicate keys from properties file