currentProfile.getFriends()
method returns a Iterator over a ArrayList. It works as supposed but the compiler gives me a friendly warning when assigning it to another iterator: iterator is a raw type. References to generic type Iterator <E> should be parameterized
I have little or no idea what this means, care to enlighten me? if my description were not clear enough, this is what I am doing Iterator friendList = currentProfile.getFriends();
Please looks at the signature of the method getFriends() if you can. That should look like
public Iterator<some type> getFriends()
the is the type you need to put in the Iterator reference. For example if the method is:
public Iterator<Friend> getFriends()
use:
Iterator<Friend> friendList = currentProfile.getFriends();
`Java: Warning: References to generic type should be parameterized`
what it means is you are assigning an object with the generic type set to a reference which has no generic type declared.
Example:
List<String> list = new ArrayList<String>();
Iterator itr= list.iterator(); // you'd get that warning on this line, as you are not making iterator a generic type.
it'd disappear when you do this
Iterator<String> itr = list.iterator();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With