How do I pass an ArrayList to method that takes a collection as an input

Posted by Ankur on Stack Overflow See other posts from Stack Overflow or by Ankur
Published on 2010-05-06T05:13:30Z Indexed on 2010/05/06 5:18 UTC
Read the original article Hit count: 203

I want to pass some ArrayList X into method a(Collection someCol) that takes Collection as an input.

How can I do this? I thought an ArrayList was a Collection and thus I should be able to "just do it" but it seems that Collection is an interface and ArrayList implements this interface. Is there something I can do to make this work ... if you understand the theory that would also help me and possibly lots of other people.

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about arraylist