george smiley
george smiley

Reputation: 2791

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?

Upvotes: 0

Views: 104

Answers (2)

Tom
Tom

Reputation: 44821

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.

Upvotes: 0

does this have to do with generics

Yes. You can read up about generics here.

Upvotes: 1

Related Questions