I'd like to implement a simple class (in Java) that would allow me to register and deregister strings, and on the basis of the current set of strings auto-complete a given string. So, the interface would be:
- void add(String)
- void remove(String)
- String complete(String)
What's the best way to do this in terms of algorithms and data-structures?