枚举转map
时间:2018-11-12 16:46:05
收藏:0
阅读:449
import java.util.HashMap; import java.util.Map; public enum PayType { ALIPAY("支付宝扫码", 15), WEIXIN_PAY("微信扫码", 16) PayType(String name, int value) { this.name = name; this.value = value; } public int value; public String name; public static Map<String, PayType> typeMap = new HashMap<String, PayType>(); static { PayType[] types = PayType.values(); for (PayType type : types) { typeMap.put(String.valueOf(type.value), type); } } }
原文:https://www.cnblogs.com/james-roger/p/9946953.html
评论(0)