Generic Methods
This can be applied to methods:
public <V> V process(final V input);
This example will force the input and output to be the same type.
ModelObject input;
ModelObject output:
AnotherObject invalid;
input = new ModelObject();
output = process(input);
// Compilation error
invalid = process(input);
Last updated
Was this helpful?