I'm wondering what is the proper way to call a static method with a signature like this:
public static Map> aggregate(List> list, String colK, String colV)
{
...
}
I was tempted to call it like this for some reason
Map> map = aggregate(lData, "id", "ref");
but it didn't compile unless I changed it to
Map> map = aggregate(lData, "id", "ref");
I'm just wondering why it didn't need the hints on the right hand side. And instead gave me compilation error. It says it expects a semi-colon after the hints on the right hand side. Is the second one a proper way to call the method? Could somebody shed me some light please?
解决方案
As shown here, the way to call the method would be:
ClassName.aggregate(lData, "id", "ref");
where ClassName is the name of the class that the method is contained in.