技术:java8
运行环境:IDEA 15.2 + jdk8 + windows 10
demo功能:提供java 枚举
public enum TransportationsEnum {
UNKNOWN(0, "未知"),
CAR(1, "小汽车"),
BUS(2, "巴士"),
TRAIN(3, "地铁");
private int val;
private String name;
TransportationsEnum(int val, String name) {
this.val = val;
this.name = name;
}
public static TransportationsEnum getByVal(int val) {
for (TransportationsEnum item : values()) {
if (item.getVal() == val) {
return item;
}
}
return TransportationsEnum.UNKNOWN;
}
public int getVal() {
return val;
}
public String getName() {
return name;
}
}
欢迎添加微信,互相学习↑↑↑ -_-
白老虎
programming is not only to solve problems, ways to think
grafana 级连 菜单 templating (variables) 配置
rocketmq 集群搭建 (2master + 2slave + 2namesrv)
AI 机器人 抓取 微信 聊天中的 百度网盘 分享地址和密码