开发者

java syntax question

What do these lines of code do?

private interface ComparisonCallback<ComparisonT>
{
    public ComparisonT getComparisonValue(CVRDataElement e);
}

followed by this method declaration:

public <ComparisonType> List<MyDataTable> getGenericSubTable(ComparisonCallback<开发者_如何转开发;ComparisonType> cc)

Specifically, I don't understand the ComparisonType tag - does this have to do with generics?


does this have to do with generics

Yes. You can read up about generics here.


The first interface is the definition of a callback function to be used in the getGenericSubTable method.

The getGenericSubTable parameterizes the return value of the callback function, so it's saying that to do what it needs to do it needs the callback function but that it doesn't care what the type of its return type is.

What it probably means is that you use the callback to return the object that you want it to use for comparison from the CRVDataElement object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜