wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Java 5 -Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Java 5 -Collection" Watch "Java 5 -Collection" New topic
Author

Java 5 -Collection

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

I want to know why the following Collection<E> interface methods, accept Collection<?> as the parameter and not Collection<? super E>

boolean containsAll(Collection<?> c)
boolean removeAll(Collection<?> c)
boolean retainAll(Collection<?> c)


If I create a Collection<String>, does invoking c.containsAll(m) (where m is Collection<Map> make sense? :roll: I dont think so. Could someone explain?
Thanks
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
I'm moving this to...Java In General (Advanced).
[ December 30, 2004: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
jQuery in Action, 2nd edition
 
subject: Java 5 -Collection
 
Similar Threads
Questions on Collection Interface.
Generics problem
Question about generics
Java 5 -Collection
Collections / Generics Question