我可以使用IntelliJ IDEA重构替换lambda表达式为等效表达式吗?谢谢。
public class StateOwner {
public void addStateListener(StateChangeListener listener) { ... }
}
..
StateOwner stateOwner = new StateOwner();
stateOwner.addStateListener(
(oldState, newState) -> System.out.println("State changed")
);
我能否让IntelliJ IDEA用新的表达式替换lambda表达式部分?
stateOwner.addStateListener(new StateChangeListener() {
public void onStateChange(State oldState, State newState) {
System.out.println("State changed")
}
});