In a Java program I have a set of key-value objects and would like to write a String with those properties (that I return as a REST service response).
Everything is fine when using java.util.Properties
Properties props = new Properties();
props.put("prop-key", "prop-value");
Writer writer = new StringWriter();
store(writer, "## File comment ##");
This generates the string
## File comment ##
prop-key=prop-value
Now I would like to add comments at each property like this one
## File comment ##
## Property comment
prop-key=prop-value
But using Java's Properties this is not possible. How can I accomplish this task apart from using a StringBuilder or something like that?
Thank you