: Returns a list of all terms that begin with the same characters as the given prefix.
Given the terms [alpha, delta, do, cats, dodgy, pilot, dog], `allMatches("do")` should return [do, dodgy, dog] in any order. Here's this example using the `TreeSetAutocomplete` class included in the project.
Given the terms [alpha, delta, do, cats, dodgy, pilot, dog], `allMatches("do")` should return [do, dodgy, dog] in any order. Try this example yourself by writing a new test case in the `AutocompleteTests` class. You can write additional test cases like this to assist in debugging.
1. Open the **Project tool window**, right-click the "**src**" folder, select **New \| Java Class**, and give the new class a name such as `SimpleExample`.
1. Start typing "main" and press **Tab** or **Enter** on your keyboard. IntelliJ [should automatically expand it](https://youtu.be/ffBeoE6NBSs?t=27) to `public static void main(String[] args)`.
1. Copy and paste the code snippet into your generated `main` method.
1. Move your cursor over the red-colored text for the `List` declaration that you just pasted. In the dropdown, select the suggestion to import the classes from `java.util`.
1. Finally, [run the class](https://www.jetbrains.com/help/idea/running-applications.html#quick-way) by finding the green ▶️ button in the gutter next to the `SimpleExample` class definition and choosing **Run 'SimpleExample.main()'**.
If everything works, you should see `[do, dodgy, dog]` in the run tool window.
### Reference implementation
The project code includes a fully functional `TreeSetAutocomplete` implementation that stores all the terms in a `TreeSet`. The class contains a single field for storing the underlying `TreeSet` of terms. Rather than declare the field as a `Set`, we've chosen to use the more specialized subtype `NavigableSet` because it includes helpful methods that can be used to find the first term that matches the prefix.