I'm learning about Generics myself, so I cannot give you a definitive answer. What seems to help me is to forget about the actual list (ArrayList<Integer> ) and only consider the List<?> list1 part. So you give me one of those. It's a list of something but I do not know what kind of something. So how do I know that I can add a boxed int to it? It could be a list of Strings for all I know. To enforce stricter type checking Java 5.0 refuses to do this to a list specified by an unbounded wildcard.
If you just specify List list1 then the compiler says "this is just legacy stuff, I hope the programmer knows what he's upto. But I'd better warn him that he's in for trouble if that ain't a list of Integers." [ December 12, 2006: Message edited by: Barry Gaunt ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Why this difference in List <?> and List