Here you can find the source of possibilities(Class
public static <ENUM extends Enum<ENUM>> Iterable<String> possibilities(Class<ENUM> enumClass)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.EnumSet; import java.util.List; public class Main { public static <ENUM extends Enum<ENUM>> Iterable<String> possibilities(Class<ENUM> enumClass) { EnumSet<ENUM> values = EnumSet.allOf(enumClass); List<String> result = new ArrayList<>(values.size()); for (ENUM value : values) { result.add(value.toString()); }//w w w . jav a 2s. c o m return result; } }