I have a String[] with values like so:
String[]
public static final String[] VALUES = new String[] {\"AB\",\"BC\",\"CD\",\"AE\"};
Given
Using a simple loop is the most efficient way of doing this.
boolean useLoop(String[] arr, String targetValue) { for(String s: arr){ if(s.equals(targetValue)) return true; } return false; }
Courtesy to Programcreek