I am learning how to use HashMaps,
my test project is working, but i need to get rid of some warnings,
public static void main() {
Map <String, String>mMap = new HashMap<String, String>(); //crea nuevo HashMap
mMap.put("llave 1", "la llave uno"); //le mete cosas al hashMap
mMap.put("llave 2", "la llave dos");
mMap.put("llave 3", "la llave tres");
mMap.put("llave 4", "la llave cuatro");
Iterator iter = mMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry menEntry = (Map.Entry) iter.next();
Log.d("msg", "key:"+menEntry.getKey() +" value:"+menEntry.getValue());
} } }
so on
Iterator iter = mMap.entrySet().iterator();
i get the warning: multiple markers at this line the autocompletition point to Iterator <E> what is this, the cast?, Error?, what to put in there?
also same warning in:
Map.Entry menEntry = (Map.Entry) iter.next();
Thanks a lot!
Its because you are not defining the type at couple of place, that is
and
Edit
You can have a look at Generics in JAVA 1.5,
hereis a small explanation for that.