我是 Java 的新手... 我已经创建了一个类似于下面的链式哈希表:
Map<String, Double> MonthlyCPIMenu = new LinkedHashMap<String, Double>();
MonthlyCPIMenu.put("1394/10", 0.0);
MonthlyCPIMenu.put("1394/09", 231.6);
MonthlyCPIMenu.put("1394/08", 228.7);
MonthlyCPIMenu.put("1394/07", 227.0);
MonthlyCPIMenu.put("1394/06", 225.7);
我知道如何使用以下方法找到每个项的索引(例如):
String duemonth="1394/08";
int indexduemonth = new ArrayList<String>(MonthlyCPIMenu.keySet()).indexOf(duemonth);
但我不知道如何使用索引查找值。(我知道如何使用键获取值,但在这种情况下我应该使用索引)