I have an array named \"bob\" which contains values.
String[] bob = { \"this\", \"is\", \"a\", \"really\", \"silly\", \"list\" };
How can I kno
Convert the Array to List using static Arrays.asList(T)
and check with List.contains(Object)
to check if an object exists in the retuned collection.
String[] bob = { "this", "is", "a", "really", "silly", "list" };
System.out.println(Arrays.asList(bob).contains("silly"));
Traditional way however would be to iterate over the array and check at each element using equals().