Addd containsAny method with array paramater.
This commit is contained in:
parent
db6f7bddea
commit
e389f37603
1 changed files with 46 additions and 0 deletions
46
src/fr/devinsy/util/strings/StringList.java
Executable file → Normal file
46
src/fr/devinsy/util/strings/StringList.java
Executable file → Normal file
|
@ -538,6 +538,52 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public boolean containsAny(final String... target)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean ended = false;
|
||||
int index = 0;
|
||||
result = false;
|
||||
while (!ended)
|
||||
{
|
||||
if (index < target.length)
|
||||
{
|
||||
String current = target[index];
|
||||
|
||||
if (this.contains(current))
|
||||
{
|
||||
ended = true;
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
|
|
Loading…
Reference in a new issue