Generic function for Map of maps in Java
===

I am trying to write a generic function which will accept both of the following data types

    Map <Integer, Map<Integer, Long>>
    Map <Integer, Map<Integer, Double>>

My function looks like this,

    function(Map <Integer, Map<Integer, ? extends Number>>) {}

But I am getting an incompatible type error. It works for a Map, but not for map of Maps. I am not able to understand why? Is there any way to do this?

Thanks.

 