I have several warnings with the following caption:
**Multiple markers at this line
- Map is a raw type. References to generic type Map<K,V> should be
parameterized
- Map is a raw type. References to generic type Map<K,V> should be
parameterized**
Does anyone know how to declare correctly?
This is my code.
static Map ordenarPorValue(Map map) {
List list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
public int compare(Object o1, Object o2) {
return ((Comparable) ((Map.Entry) (o1)).getValue())
.compareTo(((Map.Entry) (o2)).getValue());
}
});
Map result = new LinkedHashMap();
for (Iterator it = list.iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry)it.next();
result.put(entry.getKey(), entry.getValue());
}
return result;
}