Search code examples
javaproperties

Multiple values in java.util.Properties


It seems that java.util.Properties assumes one value per propery key. That is,

foo=1
foo=2

is not expected,

Is there a class for this kind of multi-value property sheet, which also provides the load method?


Solution

  • Try:

    foo=1,2
    
    String[] foos = properties.getProperty("foo", "").split(",");