标签:eve for imp map list sort hashmap ret util system
import java.util.*;
public class EntrySets {
public static void main(String[] args) {
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("k1", "v1");
map.put("k2", "v2");
getItem(map);
List<Object> kk = new ArrayList<Object>();
kk.add("1");
kk.add("aa");
kk.add("A");
print(sortList(kk));
}
static void getItem(Map map) {
map.forEach((key, value) -> print(key + ":" + value));
}
static void iterByKey(Map map) {
/** iter map by key */
for (Object k : map.keySet()) {
String v = map.get(k).toString();
}
}
static void print(Object o) {
System.out.println(o);
}
static List sortList(List list){
Collections.sort(list);
// 反转
//Collections.reverse(list);
return list ;
}
}
标签:eve for imp map list sort hashmap ret util system
原文地址:https://www.cnblogs.com/SunshineKimi/p/12233425.html