How do I determine whether an array contains a particular value in Java?
Asked 07 September, 2021
Viewed 2.9K times
  • 54
Votes

I have a String[] with values like so:

public static final String[] VALUES = new String[] {"AB","BC","CD","AE"};

Given String s, is there a good way of testing whether VALUES contains s?

29 Answer