How can I check if an element exists in a Set of items?

static final List<String> fruits = Arrays.asList("APPLE", "ORANGES", "GRAPES");

if (fruits.contains(fruitname))

If your list was much larger, a set would be more efficient.

static final Set<String> fruits = new HashSet<String>(
       Arrays.asList("APPLE", "ORANGES", "GRAPES", /*many more*/));

for completeness using google-collections/guava:

import com.google.common.collect.Sets;

static final Set<String> fruit = Sets.newHashSet("APPLE", "ORANGES", "GRAPES");

if (fruit.contains(fruitname))

or using the plane old jdk classes:

static final Set<String> fruit = new HashSet<String>(Arrays.asList("APPLE", "ORANGES", "GRAPES"));