Type mismatch: cannot convert from ArrayList<Data> to MyCollection

Posted by Tommy on Stack Overflow See other posts from Stack Overflow or by Tommy
Published on 2010-04-08T12:06:34Z Indexed on 2010/04/08 12:13 UTC
Read the original article Hit count: 247

Filed under:
|

I've read similar questions here but I'm still a little confused.

 MyCollection extends ArrayList<MyClass>

 MyClass implements Data

yet this gives me the "cannot convert from ArrayList to MyCollection"

 MyCollection mycollection = somehandler.getCollection();

where getCollection looks like this

 public ArrayList<Data> getCollection()

So my assumptions are obviously wrong. How can I make this work like I would like it to

© Stack Overflow or respective owner

Related posts about java

Related posts about generics