Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read duplicate keys from properties file

 
Robin Sharma
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to read duplicate keys from a properties file.

Thanks.
 
ak pillai
author
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic