Skip to content Skip to sidebar Skip to footer

Arraylist Is A Raw Type. References To Generic Type Arraylist Should Be Parameterized

I have this Method(): private List> creaListaDeGrupos() { ArrayList resultado_padre = new ArrayList(); for (int i = 0; i &l

Solution 1:

You could try creating the same type you are returning:

List<HashMap<String, String>> = newArrayList<HashMap<String, String>>();

There is no need to declare the implementation type, i.e. ArrayList. The List interface is more general, so when declaring variables as a concrete type, ask yourself if this is necessary. See Programming against interface

Solution 2:

It will be ArrayList<HashMap<String, String>>

Solution 3:

privateList<Map<String, String>> creaListaDeGrupos() { 

            List<Map<String, String>> resultado_padre = newArrayList<Map<String, String>>() ; 
            for (int i = 0; i < listadoPartidas.getPartidas().size(); i++) { 
                Map<String, String> padre = newHashMap<String, String>(); 
                padre.put("posicionLista", posicionlista.get(i)); 
                padre.put("codigo", codigoBaremo.get(i)); 
                padre.put("descripcionBaremo", descripcionBaremoPadre.get(i)); 
                padre.put("cantidad", cantidad.get(i)); 
                padre.put("importe", importe.get(i)); 
                padre.put("estado", estado.get(i)); 
                padre.put("observaciones", observaciones.get(i)); 
                resultado_padre.add(padre); 
            } 
return resultado_padre 
} 

Post a Comment for "Arraylist Is A Raw Type. References To Generic Type Arraylist Should Be Parameterized"