Java wildcard generic propblem: Compiler assumes different types for same object?

. Yes, you know that any element that's already in the collection should be able to be added to it, but the type doesn't reflect that.? and? Extends Foo should only be used when you only need to retrieve objects from the collection and not add to it.

Can you show why you need to use a wildcard as opposed to, say Collection.

You can't add a string object in to a collection of type Collection, because the type Collection itself means that you don't know the type of the collection, hence the compiler won't allow you to add arbitrary types in it.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions