how to replace anonymous with lambda in java

前端 未结 5 991
别跟我提以往
别跟我提以往 2021-01-31 01:32

I\'ve got this code but IntelliJ tells me to replace anonymous with lambda but I don\'t know how. can anyone help me with this? Here is my code:

soundVolume.valu         


        
5条回答
  •  一生所求
    2021-01-31 02:24

    for code clarity, you can also declare a variable with lambda and pass that variable to addListener method. for example

    soundVolume.valueProperty().addListener(listener);

    ChangeListener listener = (observable, oldValue, newValue) -> { ... };

提交回复
热议问题