Генерики с масками
От: JazzzMaster Россия  
Дата: 27.05.10 16:39
Оценка:
    public HashMap<String, ?> marshal(List<?> list) throws Exception {

        HashMap<String, ?> hash = new HashMap<String, Object>();

        for (Object object : list) {

            Method m = list.getClass().getMethod("getClassified", (Class<?>[])null);
            if (m == null) {
                throw new Exception("Method getClassified not found!");
            } else {
                Object classified = m.invoke(object, (Object[])null);
                hash.put(classified.toString(), object);
            }

        }
        return hash;
    }


Eclipse ругается на строчку hash.put(...)
The method put(String, capture#4-of ?) in the type HashMap<String,capture#4-of ?> is not applicable for the arguments (String, Object)
Не могу понять, что ему надо..
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.