Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.java.ao.util;
 
 
 
 import static com.google.common.collect.Lists.newArrayList;
 
 public final class EnumUtils
    public static Iterable<Enumvalues(Class<? extends Enumtype)
    {
        try
        {
            return newArrayList((Enum[]) type.getMethod("values").invoke(null));
        }
        catch (IllegalArgumentException e)
        {
            throw new IllegalStateException(e);
        }
        catch (SecurityException e)
        {
            throw new IllegalStateException(e);
        }
        catch (IllegalAccessException e)
        {
            throw new IllegalStateException(e);
        }
        catch (InvocationTargetException e)
        {
            throw new IllegalStateException(e);
        }
        catch (NoSuchMethodException e)
        {
            throw new IllegalStateException(e);
        }
    }
    public static int size(Class<? extends Enumtype)
    {
        return Iterables.size(values(type));
    }
New to GrepCode? Check out our FAQ X