Add method for Collection.

This commit is contained in:
asofold 2014-04-07 09:46:49 +02:00
parent af5e38b0a8
commit dcb48c8800

View File

@ -109,7 +109,7 @@ public class CharPrefixTree<N extends CharNode<N>, L extends CharLookupEntry<N>>
/**
* 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<N extends CharNode<N>, L extends CharLookupEntry<N>>
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<String> inputs){
for (final String input : inputs){
if (hasPrefixWords(input)){
return true;
}
}
return false;
}
public boolean isPrefix(final char[] chars){
return isPrefix(toCharacterList(chars));
}