Deepa Sreedhara wrote:I would like to know the difference between addAll(? extends E) and add(? super E) notation in Collection interface. I understand the purpose for using 'super' in add(). Why isn't addAll() using 'super' instead of 'extends' for adding elements?
I don't think the Collection interface has an add that takes ? super E. The only add and addAll methods I see are the ones listed below.
boolean add(E e)
boolean addAll(Collection<? extends E> c)
Try to understand now why the addAll takes a Collection<? extends E> c?
Edit : Those and the two others that take the index as a parameter also.