2021
09-16
09-16
Java源码解析之详解ImmutableMap
一、案例场景遇到过这样的场景,在定义一个static修饰的Map时,使用了大量的put()方法赋值,就类似这样——publicstaticfinalMap<String,String>dayMap=newHashMap<>();static{dayMap.put("Monday","今天上英语课");dayMap.put("Tuesday","今天上语文课");dayMap.put("Wednesday","今天上数学课");dayMap.put("Thursday","今天上音乐课");dayMap.put("Sunday","今天上编程课");......}当时,我就...
继续阅读 >