看不懂这段数组的赋值代码。
public RemoteControl() { onCommands = new Command[7]; offCommands = new Command[7]; for (int i = 0; i < 7; i++) { onCommands[i] = () -> { }; offCommands[i] = () -> { }; } }
这是啥意思啊?
onCommands[i] = () -> { }; offCommands[i] = () -> { };
按这样子运行,结果是对的;
但如果改成 等于null,就会报错,显然“() -> { }”并不代表赋空值。
炎炎设计