Here's a use case that I'd like addressed by generics: Removing the redundant casting in a test data factory. Here's an example in today's world:
Account testAccount = (Account)testRecordSource.getRecord(Account.SObjectType).withInsert();
And here's how it might look with generic methods:
Account testAccount = testRecordSource.getRecord<Account>().withInsert();
Now, this would require the implementation of getRecord() to have access to the fully qualified name of the type it is parameterised with. The data factory here is using the SObjectType to find a CMDT record which tells it how to make a valid Account in this org.
More generally it would be great to have access to the Type at runtime within the generic method. That way, you'd be able to do things like call newInstance().
To take it even further, it would be cool to have Type.newInstance() also be generic. That way I could write a generic method like this:
public T myMethod<T extends SObject>() {
T newInstance = T.newInstance<T>();
// Do some things with newIstance
return newInstance;
}
Some of this might be a bit a bit fuzzy in my use of generics since I've been in Apex so long I've somewhat forgotten Java, C++, and C#