Possible Duplicate:
Java Generics
To be more specific, whats the role of the <String> in the following line of code?
private List<String> item = new ArrayList<String>();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Mainly to allow the compiler to raise an error if you don’t insert the right kind of data into the list or if you expect data of the wrong type from the list at the moment of extraction
But see the generics tutorial for an explanation: http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html