Void value as return parameter

后端 未结 8 2482
夕颜
夕颜 2021-02-19 18:50

I have this interface:

public interface Command {
    T execute(String... args);
}

it works fine for most uses. But when I try to mode

8条回答
  •  时光取名叫无心
    2021-02-19 19:26

    It looks fine to me. As others said, Void was originally designed for the reflection mechanism, but it is now used in Generics quite often to describe situations such as yours.

    Even better: Google, in their GWT framework, use the same idea in their examples for a void-returning callback (example here). I say: if Google does it, it must be at least OK.. :)

提交回复
热议问题