Persistence of Map using same format as java.util.Properties (load/store), but ordered maintained. Open Source Java project under GNU General Public License, version 2, with the Classpath Exception.
Current Stable Version is 1.0.0
import org.javastack.stringmappersist.StringMapPersist;
public class Example {
public static void main(final String[] args) throws Throwable {
Map<String, String> map = new LinkedHashMap<String, String>();
StringMapPersist p = new StringMapPersist(map);
map.put("state", "awake");
map.put("msg", "Hi user, how are you?");
p.store(System.out, "DATA");
}
}
state=awake
msg=Hi user, how are you?
Add the dependency to your pom.xml:
<dependency>
<groupId>org.javastack</groupId>
<artifactId>stringmappersist</artifactId>
<version>1.0.0</version>
</dependency>
Inspired in Java Properties, this code is for compatibility format.