I am new to Android. Basically done programming in C++. There is a small notation I don’t understand. Can Anybody help me with this?
Ex: HashMap<String, String> o = (HashMap<String, String>)
My question is what is the use of < and > signs. Sometimes there is one parameter, sometimes there are more, and some look like a data structure.
Ex: ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
Why there are two parameters inside?
sometimes I saw it with a question mark: AdapterView<?>.
For what purpose you use the < and > sign?
This confuse me more than anything else.
Thank you in advance
These are Java generics..
It specifies that this is not
just an arbitrary HashMap, but a HashMap with Key and its value as a String parameters, written
HashMap < String, String>.We say that HashMap is
a generic interface that takes a type parameters – in this case, String.
To know more about generics, you can have a look here