java for loop executes extra iteration
There's no need to create nameList
as an array for this. You can iterate the propNames
set directly:
private static void addProperties(Properties prop) {
Set<String> propNames = prop.stringPropertyNames();
for (String propName: propNames) {
String propertyValue = prop.getProperty(propName);
allProp.put(propName, propertyValue);
loadOldValues(propName, propertyValue);
}
}
You might also be able to make use of allProp.putAll(prop)
rather than iterating through the keys (though this might require restructuring loadOldValues
).