Question: I would like to know how can I make the numbers to stay at the textfield of my calculator instead of disappear like when I type 1 then hit the + sign the number 1 disappears from the textfield. I would like to have this (1+1) showing in the text field and also if try to press only + , \* , - , / to show error. My if else statements won't work.

I'm using netbeans I'm start to learn how to program I would like to have some more ideas about programming and some good books.

This is part of my code it is working but not the way that I want to.

```
private void jbtNum1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    display = jtfResult.getText();
    jtfResult.setText(display + "1");
}                                       

private void jbtNum2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    display = jtfResult.getText();
    jtfResult.setText(display + "2");
} 

```

Answer: 
Use a view

```
xs.view.map(f).find(g)

```
Another possibility would be to use `collectFirst`, which also returns an `Option`.

```
xs.collectFirst{case x if g(f(x)) => f(x)}

```

The only downside is that you evaluate `f(x)` twice if you find something that matches.
I'm not sure if it is somehow possible to bind the result `f(x)` to some variable.