How to read the property file when duplicate key-value pair exist in the file?

user3089783 picture user3089783 · Dec 11, 2013 · Viewed 19.7k times · Source

I am loading my property file using the load() of properties class.I am able to read the key-value pair of the property class using set,hashmap,treeset,enumeration, but it does not retrieve the duplicate pairs. The duplicate pairs are retrieved only once.

Answer

Mark picture Mark · Dec 11, 2013

PropertiesConfiguration from Apache Commons Configuration supports loading a properties file with multiple entries with the same key.

Use the getStringArray(key) method or getList(key) method to access all values for the specified key.