Problem with Widcards



I cannot understand the error.

Test.java:24: test(java.util.Map<java.lang.Long,java.util.List<?>>) in
Test cannot be applied to
(java.util.Map<java.lang.Long,java.util.List<java.lang.Double>>)
test(map);
^
1 error

What am I doing wrong?

As an example here is a code:
import java.util.*;


public class Test {
static void test(Map<Long, List<?>> map) {
for(Long id : map.keySet()) {
System.out.println(id);
for(Object obj : map.get(id)) {
System.out.println(obj);
}
}
}

public static void main(String[] args) {
Map<Long, List<Double>> map = new TreeMap<Long, List<Double>>();
for(long i = 1; i < 5; i++) {
List<Double> array = new ArrayList<Double>();
for(int j=3; j < 6; j++) {
array.add((double)i*j);
}
map.put(i, array);
}

test(map);
}
}

.



Relevant Pages