Reputation: 1
I have the following code below:
ArrayList<Double> storeMath = new ArrayList<Double>();
oneButton.setOnAction(e -> calculator_screen.appendText(listOfButtons[1]));
oneButton.setOnAction(e -> storeMath.add(1.0));
I want the text to append as well as adding 1.0 to my ArrayList. Unfortunately, it appears that the second lambda is making the appendText to not happen. My goal is to create a calculator so that when you click oneButton it stores 1.0 to the ArrayList and makes 1 appear in my textBox.
Upvotes: 0
Views: 35
Reputation: 86774
Do you know that a lambda can contain more than one statement?
oneButton.setOnAction(e -> {
calculator_screen.appendText(listOfButtons[1]);
storeMath.add(1.0;) } );
Upvotes: 2