Problem with Widcards
- From: astyskin@xxxxxxxxx
- Date: 27 Feb 2006 06:09:15 -0800
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);
}
}
.
- Follow-Ups:
- Re: Problem with Widcards
- From: IchBin
- Re: Problem with Widcards
- Prev by Date: Re: midlet to record phone calls
- Next by Date: Re: A simple question about istrue of Ant.
- Previous by thread: About classpath
- Next by thread: Re: Problem with Widcards
- Index(es):
Relevant Pages
|
|