K
kelvSYC
One application of generics is probably in a return type, for example
public class Delegate<Ret> {
public Ret dothis() {
// ...
}
}
This of course implies that something is to be returned. Now, this
has probably been asked before, but what is a safe way to simulate a
void delegate? Would it be to do something like:
public class VoidDelegate extends Delegate<Void> {
public Void dothis() {
// ...
return null; // Void is non-instanced, so that's the only
thing we can return
}
}
public class Delegate<Ret> {
public Ret dothis() {
// ...
}
}
This of course implies that something is to be returned. Now, this
has probably been asked before, but what is a safe way to simulate a
void delegate? Would it be to do something like:
public class VoidDelegate extends Delegate<Void> {
public Void dothis() {
// ...
return null; // Void is non-instanced, so that's the only
thing we can return
}
}