1

in Combinator class:

public static <KEY, T> void getCombsIntoTreeMap(int N, int K,  
                                           TreeMap<KEY, T> map, 
                                           Class<? extends KEY> keyIstance, 
                                           Class<? extends T> valueIstance)
{...}

and in Comp class;

TreeMap<Hand, int[]> mappa = new TreeMap<Hand, int[]>();  
int[] keyIstance = new int[2];  
Hand valueIstance = new Hand( new int[]{0} );  
Combinator.getCombsIntoTreeMap(53, 5, mappa, 
                               keyIstance.getClass(), 
                               valueIstance.getClass() ); 

;

the compiler just says:

Comp.java:85:  <KEY,T>getCombsIntoTreeMap(int,int,java.util.TreeMap<KEY,T>,java.lang.Class<? extends KEY>,java.lang.Class<? extends T>) in Combinator cannot be applied to (int,int,java.util.TreeMap<Hand,int[]>,java.lang.Class<capture#86 of ? extends int[]>,java.lang.Class<capture#138 of ? extends Hand>)
    Combinator.getCombsIntoTreeMap(53, 5, mappa, keyIstance.getClass(), valueIstance.getClass() );
              ^

I need help.
Thanks

2
  • Seems you have keyIstance and valueIstance the wrong way around somewhere. Commented Mar 12, 2011 at 20:57
  • sorry... I didn't used &lt and &gt Commented Mar 12, 2011 at 20:58

1 Answer 1

4

Well your Map instance has the type parameter list <KEY, T>, and your function wants the "KEY" class first and the "T" class second, but you're passing the classes into the function in the wrong order.

In other words, your map is declared with the "KEY" being "Hand" and the value being "int[]", but your "keyIstance" (should be "Instance" by the way) has type int[] and that seems backwards.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah in a Map the first type argument is the key type and the second is the value type. keyIstance and valueIstance are thus named inconsistently with your map declaration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.