TreeMap排序和Map的遍历

时间:2025-04-03 19:39:43

public class Test4 {
 public static void main(String[] args) {
  Map<String, String> treeMap = new TreeMap<String, String>(new Comparator<String>() {
   public int compare(String str1, String str2){
    return (str2);
   }
  });
  ("abc", "you");
  ("bcd", "aou");
  
  Set<Entry<String, String>> set = ();
  for(Iterator<Entry<String, String>> it = (); (); ){
   Entry<String, String> entry = ();
   String key = ();
   String value = ();
   (key);
  }
  
 }
}