java - Issue with interface and parameter -


i have problem interface , parameters:

public class functions {   public static double getinfosum(treemap<string, iinterface> map){     ....some counting   } }  public class exampleclass {    private treemap<string, exampleclassitem > xxxx;    public static void somefunction(){     functions.getinfosum(xxxx); //here error    } }   public class exampleclassitem implements iinterface {    .....  } 

is there other possibility except this:

private treemap<string, exampleclassitem > xxxx; -----> private treemap<string, iinterface > xxxx; 

because need work exampleclassitem there specific functions can not in interface.

you can change

public static double getinfosum(treemap<string, iinterface> map){  ....some counting } 

to

public static double getinfosum(treemap<string, ? extends iinterface> map){  ....some counting } 

this allow pass treemap<string, exampleclassitem> method.


Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -