Jesper的回答很好。另一种解决方案是使用TreeMap(您要求其他数据结构)。
TreeMap<String, String> myMap = new TreeMap<String, String>();String first = myMap.firstEntry().getValue();String firstOther = myMap.get(myMap.firstKey());
TreeMap有开销,因此HashMap更快,但仅作为替代解决方案的一个示例。

Jesper的回答很好。另一种解决方案是使用TreeMap(您要求其他数据结构)。
TreeMap<String, String> myMap = new TreeMap<String, String>();String first = myMap.firstEntry().getValue();String firstOther = myMap.get(myMap.firstKey());
TreeMap有开销,因此HashMap更快,但仅作为替代解决方案的一个示例。