While dealing with heterogeneous containers (i.e. database cursor with strings, ints etc.), what (and why) is better approach:
Vector<?>
or
Vector<Object>
You can substitute Vector for any other Collection, that’s just example.
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.
I’m not exactly sure what you’re comparing. Trying to create a vector like
gets an error,
Cannot instantiate the type Vector<?>If you use
<?>in a parameter list (without using the super keyword) that means you can’t insert anything into the collection. If you use<Object>then you can insert and remove things.