1. /**
    2. * 英雄类型
    3. */
    4. public enum HeroType {
    5. TANK("坦克"),
    6. WIZARD("法师"),
    7. ASSASSIN("刺客"),
    8. ASSIST("辅助"),
    9. WARRIOR("近战"),
    10. RANGED("远程"),
    11. PUSH("推进"),
    12. FARMING("打野");
    13. public final String typeStr;
    14. HeroType(String typeStr) {
    15. this.typeStr = typeStr;
    16. }
    17. }
    18. class Test {
    19. public static void main(String[] args) {
    20. HeroType[] values = HeroType.values();
    21. Arrays.stream(values).forEach((item) -> System.out.println(item.toString() + ": " + item.typeStr));
    22. }
    23. }