Convert Properties into Map
import java.util.Properties;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Properties properties = new Properties();
properties.setProperty("name", "Designer");
properties.setProperty("version", "1.0");
properties.setProperty("vendor", "Inc");
Map<String, String> map = new HashMap<String, String>((Map) properties);
Set propertySet = map.entrySet();
for (Object o : propertySet) {
Map.Entry entry = (Map.Entry) o;
System.out.printf("%s = %s%n", entry.getKey(), entry.getValue());
}
}
}
Related examples in the same category