我Map<String, List<String>> map
现在将两个值放入 Map 中,现在当从 map 中读取键集时,在不同的设备中以不同的顺序给出。
private Map<String, List<String>> map = new HashMap<>();
map.put("First", new ArrayList<String>());
map.put("Second", new ArrayList<String>());
现在,从这个映射中读取键。
Set<String> keys = map.keySet();
for (int i = 0; i < map.size(); i++) {
Log.d("key", keys.toArray()[i].toString());
}
奥利奥 8.0 的输出
D/Key : First
D/Key : Second
输出低于 8.0
D/Key : Second
D/Key : First