我型我的哈希表:如何将HashMap转换为自己的类型数组?
private HashMap<String, HashMapObject> likesYearHashMap;
其中HashMapObject:
public class HashMapObject {
private int count;
private String id;
public HashMapObject(int count, String id) {
super();
this.count = count;
this.id = id;
}
}
如何将值转换成我的HashMap来HashMapObject []数组?
我得到的错误cast getting likesYearHashMap.values();
'Map#values()'返回一个'Collection'。迭代它并将其元素添加到您的数组中。 –