I have this interface:
public interface Command {
T execute(String... args);
}
it works fine for most uses. But when I try to mode
I would stick to using Void
explicitly. It's easy to see what is going on without another class involved. It'd be nice if you could override a Void
return with void
(and Integer
with int
, etc), but that is not a priority.
That problem is not that common, but neither that rare... I think I've seen a discussion about that some time ago, about Callables that return nothing.
I agree with the other posters that this is a good solution, much better than using Object or some other dummy placeholder.