Reputation: 876
I have an String array with multiple items.
String[] folder={"proc","root","sdcard","cache","system","config","dev","sys","acct","sbin","etc"};
Now I want to check in if condition like
if(list[i].getName().equals(object))
Is there any method that can check whole array and if list[i] present in array then go into the if condition block.
Thank you in advance.
Upvotes: 7
Views: 193
Reputation: 157437
For instance:
Arrays.asList(folder).contains("sdcard");
asList
: Returns a List of the objects in the specified array.contains
: Tests whether this List contains the specified object.Upvotes: 5