



CodePudding user response:
//1
Public static void main (String [] args) {
MapThe map=new LinkedHashMap<> (a);
The map. The put (" zhou yu ", "Joe");
The map. The put (" sun quan ", "big Joe");
The map. The put (" Yang guo, "" little dragon female");
The map. The put (" lyu3 bu4, "" the sable cicada");
IteratorThe iterator=map. KeySet (). The iterator ();
While (iterator. HasNext ()) {
String key=iterator. Next ();
The String value=https://bbs.csdn.net/topics/map.get (key);
System. The out. Println (key + "-- -- -- -- --" + value);
}
}
The second question//
Public static void main (String [] args) {
ListList=Arrays. AsList (4,5,12,56,23,89,15);
The Collections. The sort (list, new Comparator() {
@ Override
Public int the compare (Integer o1, o2) Integer {
Return o1, o2.
}
});
System. Out. Println (list);
}