First key event jumps over the process
<p>i have been trying to find some info on my bug, but couldn't find anything relevant past several hours.</p>

<p>I'm using this key event handling method in the controller class. onKeyPressed lies in fxml file, on root BorderPane. Main class is standard.</p>

<p>This method is a part of my calculator app, it extracts a char from keyCode and passes it to other method.</p>

<p>And the problem is, as seen during debugging, on the first key press it doesn't even try to generate String returned, but jumps straight to the end of the method. All the other keys pressed are processed normally.</p>

<p>If i printf something just before the last curly brace, it's printed on the console on the first key press only.</p>

<p>Here is the problem method:</p>

<pre><code>    public void handleKeys() {
    container.setOnKeyPressed(key -&gt; {
        String returned = key.getCode().toString().toLowerCase();
        char chr = '0';
        switch (returned) {
            case "add":
                chr = '+';
                break;
            default:
                if (Character.toString(returned.charAt(returned.length() - 1)).matches("\\d") &amp;&amp; returned.charAt(returned.length() - 2) != 'f') {
                    chr = returned.charAt(returned.length() - 1);
                    break;
                }
        }
        handleSymbols(chr);
    });
}
</code></pre>

<p>From what i understand, on first key press setOnKeyPressed method is initialized and it skips the following code. I think i should somehow forward the process from the last curly brace back into 
key -> { part. But how?</p>