In an if
statement in Java how can I check whether an object exists in a set of items. E.g.
In this scenario i need to validate that the fruit will be an apple, orange or banana.
if (fruitname in ["APPLE", "ORANGES", "GRAPES"]) {
//Do something
}
It's a very trivial thing but I couldn't figure out a short and concise way to accomplish this.