Hari M :
In java do we have any method to find that a particular string is part of string array. I can do in a loop which I would like to avoid.
e.g.
String [] array = {"AA","BB","CC" };
string x = "BB"
I would like a
if (some condition to tell whether x is part of array) {
do something
} else {
do soemthing
}
ΦXocę 웃 Пepeúpa ツ :
Do something like:
Arrays.asList(array).contains(x);
since that return true if the String x is present in the array (now converted into a list...)
Example:
if(Arrays.asList(array).contains(x)){
// is present ... :)
}
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=451072&siteId=1