问题:
I have an enum
in Java for the cardinal & intermediate directions: 我有一个Java的enum
主要和中间方向:
public enum Direction {
NORTH,
NORTHEAST,
EAST,
SOUTHEAST,
SOUTH,
SOUTHWEST,
WEST,
NORTHWEST
}
How can I write a for
loop that iterates through each of these enum
values? 如何编写迭代这些enum
值的for
循环?
解决方案:
参考一: https://stackoom.com/question/4dSB/一个-for-循环迭代Java中的枚举参考二: https://oldbug.net/q/4dSB/A-for-loop-to-iterate-over-an-enum-in-Java
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4322284