In Java, how can I test if an Array contains a certain value?

Total Post:96

Points:676
Java  Array 
 1066  View(s)
Ratings:
Rate this:
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?
  1. Post:397

    Points:3117
    Re: In Java, how can I test if an Array contains a certain value?

    Arrays.asList(yourArray).contains(yourValue)

  1. Post:3

    Points:21
    Re: In Java, how can I test if an Array contains a certain value?

    Post is removed by the Admin.

Answer