Skip to content

Instantly share code, notes, and snippets.

@rivancic
Created June 9, 2017 06:39
Show Gist options
  • Save rivancic/897fe2b5fdca8754cc2e25630cedc6ad to your computer and use it in GitHub Desktop.
Save rivancic/897fe2b5fdca8754cc2e25630cedc6ad to your computer and use it in GitHub Desktop.
Java

Enum

Iterate over an enum in Java .values()

You can call the values() method on your enum.

for (Direction dir : Direction.values()) {
  // do what you want
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment