Grouping keystrokes

We will wrap up this chapter by integrating most of what we learned and achieve a complex task: grouping keystrokes that happen in rapid succession to form strings without any delay. It can be helpful in user interfaces to immediately jump to items in a list based on what is being typed or perform autocompletion in some way. This can be a challenging task, but as we will see, it is not that difficult with RxJava.

This exercise will use JavaFX again with RxJavaFX. Our user interface will simply have a Label that receives rolling concatenations of keys we are typing. But after 1 second, it will reset and receive an empty "" to clear it. Here is the code that achieves this:

public final class Ch7_17 extends Application { ...

Get Learning RxJava - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.