I have a list of key/value pairs of configuration values I want to store as Java property files, and later load and iterate through.
Questions:
In Java 8 to get all your properties
public static Map readPropertiesFile(String location) throws Exception {
Map properties = new HashMap<>();
Properties props = new Properties();
props.load(new FileInputStream(new File(location)));
props.forEach((key, value) -> {
properties.put(key.toString(), value.toString());
});
return properties;
}