Skip to content

Instantly share code, notes, and snippets.

@electrum
Created September 25, 2012 21:59
Show Gist options
  • Save electrum/3784732 to your computer and use it in GitHub Desktop.
Save electrum/3784732 to your computer and use it in GitHub Desktop.
package javatest;
import com.google.common.base.*;
import java.util.Arrays;
public enum RecursiveEnum
{
FOO(null),
BAR(FOO);
private final RecursiveEnum type;
RecursiveEnum(RecursiveEnum type)
{
this.type = type;
}
public RecursiveEnum getType()
{
return type;
}
@Override
public String toString()
{
return Objects.toStringHelper(this)
.add("name", name())
.add("type", type)
.toString();
}
public static void main(String[] args)
{
System.out.println(Arrays.toString(RecursiveEnum.values()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment