EL get value of a HashMap by Integer key

前端 未结 2 490
感情败类
感情败类 2020-12-18 08:11

I have this HashMap:

    Map odometerMap = new LinkedHashMap();
    odometerMap.put(0, getLocaleForKey(\"drop-d         


        
2条回答
  •  感动是毒
    2020-12-18 08:41

    An alternative could be using a String as the key

    Map odometerMap;
    

    .. and:

    
    

    But, it's better to use a List of Strings since your key doesn't have any clear meaning:

    List odometers = new ArrayList();
    odometers.add(getLocaleForKey("drop-down.any"));
    // etc
    

    .. and:

    
    

提交回复
热议问题