Re: Problem with Widcards



astyskin@xxxxxxxxx wrote:
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) {

static void test(Map<Long, List<Double>> 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);

array.add( new Double( i * j));

}
map.put(i, array);
}
test(map); }
}



--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
.



Relevant Pages

  • Re: QuickFom question
    ... Knowledge is the "Fountain of Youth"' ... -William E. Taylor, Regular Guy ... I am not a big fan of MySQL but it easy to use and 95% of Hosting sites seem to run it.. ...
    (comp.lang.php)
  • Re: JDK 1.7.0 project
    ... Standard Edition 7 Binary Snapshot Releases ... Knowledge is the "Fountain of Youth"' ... -William E. Taylor, Regular Guy ...
    (comp.lang.java.softwaretools)
  • Re: java 1.5 supported app Servers
    ... It also supports J2EE 1.5 compliance. ... Knowledge is the "Fountain of Youth"' ... -William E. Taylor, Regular Guy ...
    (comp.lang.java.programmer)
  • Re: Quick question
    ... pass it to a function insertIntoDB() to issue the insert. ... Knowledge is the "Fountain of Youth"' ... -William E. Taylor, Regular Guy ...
    (comp.lang.php)
  • Re: use JFrame before it is constructed
    ... class MyClass ... Knowledge is the "Fountain of Youth"' ... -William E. Taylor, Regular Guy ...
    (comp.lang.java.gui)