자바) enum, 열거형 (23-05-24)
velog에서 이전한 글 입니다. enum public class Test { enum Direction { EAST("East", 10), WEST("West", -10), SOUTH("South", -20), NORTH("North", 20); private final String label; private final int val; Direction(String label, int val) { this.label = label; this.val = val; } public String label() { return label; } public int val() { return val; } private static final Map BY_LABEL = Stream.of(values()).collec..
2023.07.13