Add ToolBox.matchesAny method.

This commit is contained in:
Christian P. MOMON 2014-06-08 16:39:02 +02:00
parent 23516c108a
commit c63b0923aa

View file

@ -169,6 +169,52 @@ public class ToolBox
return result;
}
/**
*
* @param string
* @param targets
* @return
*/
public static boolean matchesAny(final String string, final String... targets)
{
boolean result;
if ((string == null) || (targets == null))
{
result = false;
}
else
{
//
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < targets.length)
{
if (StringUtils.equals(string, targets[index]))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/**
*
* @return