Made ConfigurationNode.getAll() more maintainable. Thanks devinsba!

By: EvilSeph <evilseph@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-07-14 14:41:55 -04:00
parent 656403dc86
commit 0c05778bc3

View file

@ -24,27 +24,8 @@ public class ConfigurationNode {
*
* @return A map of key value pairs with the path as the key and the object as the value
*/
@SuppressWarnings("unchecked")
public Map<String, Object> getAll() {
Map<String, Object> map = new TreeMap<String, Object>();
Set<String> keys = root.keySet();
for( String k : keys ) {
Object tmp = root.get(k);
if( tmp instanceof Map<?,?> ) {
Map<String, Object> rec = recursiveBuilder((Map <String,Object>) tmp);
Set<String> subkeys = rec.keySet();
for( String sk : subkeys ) {
map.put(k + "." + sk, rec.get(sk));
}
}
else {
map.put(k, tmp);
}
}
return map;
return recursiveBuilder(root);
}
/**