- import java.util.Map;
- import java.util.Set;
- import java.util.TreeMap;
- import java.util.*;
- import javax.swing.text.html.HTMLDocument.Iterator;
- public class Test7
- {
- public static void main(String[] args)
- {
- charCount("aabbccddd");
- }
- public static String charCount(String str)
- {
- char[] ch = str.toCharArray();
- TreeMap<Character,Integer> tm = new TreeMap<Character,Integer>();
- for(int i = 0;i<ch.length;i++)
- {
- Integer value = tm.get(ch[i]);
- if(value == null)
- {
- tm.put(ch[i], 1);
- }
- else
- {
- value = value + 1;
- tm.put(ch[i], value);
- }
-
- }
- StringBuilder sb = new StringBuilder();
- Set<Map.Entry<Character,Integer>> entrySet = tm.entrySet();
- Iterator<Map.Entry<Character,Integer>> it = entrySet.iterator();//The type HTMLDocument.Iterator is not generic; it cannot be parameterized with arguments <Map.Entry<Character,Integer>>
-
- return null;
-
- }
- }
复制代码
Iterator报出了The type HTMLDocument.Iterator is not generic; it cannot be parameterized with arguments <Map.Entry<Character,Integer>> 我检查了一下午了。。。啥问题!!求助啊! |
|