Answers for "java enum get next"

3

java get next enum

public static enum A { 
    X, Y, Z;
    private static A[] vals = values();
    public A next()
    {
        return vals[(this.ordinal()+1) % vals.length];
    }
}
Posted by: Guest on May-23-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language