Java generics - passing a collection of subtype to a method requiring a collection of base type?

Change foo to: private void foo(Map in) { } That will restrict what you can do within foo, but that's reasonable. You know that any value you fetch from the map will be a list, but you don't know what kind of value is valid to put into the map.

Thanks! That's the solution exactly :-) – horace Nov 18 '08 at 10:19.

As jon s says: private void foo (Map in { ... } will fix the errors. You will still have warnings though. Take a look the get-put principle at: ibm.com/developerworks/java/library/j-jt....

Extends :-) – horace Nov 18 '08 at 10:26 java generics are not easy, "java generics and collections" (oreilly. Com/catalog/9780596527754) is very helpful. – Ray Tayek Nov 20 '08 at 6:59.

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