Created
April 5, 2014 07:18
-
-
Save gabhi/9988481 to your computer and use it in GitHub Desktop.
In Java, how can I test if an Array contains a certain value?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] VALUES = new String[] {"AB","BC","CD","AE"}; | |
String value= "AB"; | |
String notExists = "abc"; | |
Arrays.asList(VALUES).contains(value); //TRUE | |
Arrays.asList(VALUES).contains(notExists); //FALSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment