JAVA FOR each enum code example
Example 1: java loop through enum
for (Direction dir : Direction.values()) {
// do what you want
}
Example 2: loop over all values in enum
var values = Enum.GetValues(typeof(Foos)).Cast();
for (Direction dir : Direction.values()) {
// do what you want
}
var values = Enum.GetValues(typeof(Foos)).Cast();