0

I was just going through a book on java generics and I found a list of function declared and they have compared which parameters they accept to work . Please elaborate the different cases for the functions to work,

Here are the list of function declarations,

public static <T> void copy(List<T> dst, List<T> src)
public static <T> void copy(List<T> dst, List<? extends T> src)
public static <T> void copy(List<? super T> dst, List<T> src)
public static <T> void copy(List<? super T> dst, List<? extends T> src)
Prateek Joshi
  • 3,929
  • 3
  • 41
  • 51
  • I know the difference between super and extends but I want some explanation regarding the different cases mentioned above to clear my concepts more but someone marked it duplicate. :( – Prateek Joshi Jun 21 '15 at 12:25
  • The duplicate question explains exactly why some of these function definitions are incorrect. For example, you can't copy stuff into something, which doesn't allow new additions. Please read the duplicated question and the related answers very carefully. – Konstantin Yovkov Jun 21 '15 at 12:42

0 Answers0