diff --git a/NCPCommons/src/main/java/fr/neatmonster/nocheatplus/utilities/ds/prefixtree/CharPrefixTree.java b/NCPCommons/src/main/java/fr/neatmonster/nocheatplus/utilities/ds/prefixtree/CharPrefixTree.java index a59c4ff1..434b6108 100644 --- a/NCPCommons/src/main/java/fr/neatmonster/nocheatplus/utilities/ds/prefixtree/CharPrefixTree.java +++ b/NCPCommons/src/main/java/fr/neatmonster/nocheatplus/utilities/ds/prefixtree/CharPrefixTree.java @@ -109,7 +109,7 @@ public class CharPrefixTree, L extends CharLookupEntry> /** * Test hasPrefixWords for each given argument. * @param inputs - * @return true if hasPrefixWords returns ture for any of the inputs, false otherwise. + * @return true if hasPrefixWords(String) returns true for any of the inputs, false otherwise. */ public boolean hasAnyPrefixWords(final String... inputs){ for (int i = 0; i < inputs.length; i++){ @@ -120,6 +120,20 @@ public class CharPrefixTree, L extends CharLookupEntry> return false; } + /** + * Test hasPrefixWords for each element of the collection. + * @param inputs + * @return true if hasPrefixWords(String) returns true for any of the elements, false otherwise. + */ + public boolean hasAnyPrefixWords(final Collection inputs){ + for (final String input : inputs){ + if (hasPrefixWords(input)){ + return true; + } + } + return false; + } + public boolean isPrefix(final char[] chars){ return isPrefix(toCharacterList(chars)); }