Recently, in an answer, I was asked the following:
public interface Operation<R extends OperationResult, P extends OperationParam> {
public R execute(P param);
}
Better than this:
public interface Operation {
public OperationResult execute(OperationParam param);
}
However, I see no benefit in using the first code over the second ...
Given that both OperationResultand OperationParamare interfaces, the developer needs to return a derived class, and it seems to me quite obvious.
So, do you see any reason to use the first code block over the second?
source
share