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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

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

c# - Search and Add Comment with OpenXML for Word -