Skip to content

Instantly share code, notes, and snippets.

@maxp
Created August 27, 2009 13:47
Show Gist options
  • Save maxp/176291 to your computer and use it in GitHub Desktop.
Save maxp/176291 to your computer and use it in GitHub Desktop.
// use enums to implement an interface.
public interface Room {
public Room north();
public Room south();
public Room east();
public Room west();
}
public enum Rooms implements Room {
FIRST {
public Room north() {
return SECOND;
}
},
SECOND {
public Room south() {
return FIRST;
}
}
public Room north() { return null; }
public Room south() { return null; }
public Room east() { return null; }
public Room west() { return null; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment