From b9f2f3cfae45cce904da26a95eb758daa37c2847 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 24 Jun 2014 16:59:15 +1000 Subject: [PATCH] Add a getKeys method to the Configuration API --- .../java/net/md_5/bungee/config/Configuration.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/config/src/main/java/net/md_5/bungee/config/Configuration.java b/config/src/main/java/net/md_5/bungee/config/Configuration.java index 85651786..810cb1a5 100644 --- a/config/src/main/java/net/md_5/bungee/config/Configuration.java +++ b/config/src/main/java/net/md_5/bungee/config/Configuration.java @@ -1,6 +1,8 @@ package net.md_5.bungee.config; +import com.google.common.collect.Sets; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; @@ -91,6 +93,16 @@ public final class Configuration return new Configuration( (Map) ( get( path, ( def instanceof Map ) ? def : Collections.EMPTY_MAP ) ), ( defaults == null ) ? null : defaults.getSection( path ) ); } + /** + * Gets keys, not deep by default. + * + * @return top level keys for this section + */ + public Collection getKeys() + { + return Sets.newLinkedHashSet( self.keySet() ); + } + /*------------------------------------------------------------------------*/ public byte getByte(String path) {