How to implement a simple auto-complete functionality?

Posted by Kaarel on Stack Overflow See other posts from Stack Overflow or by Kaarel
Published on 2008-09-16T14:43:37Z Indexed on 2010/03/22 16:21 UTC
Read the original article Hit count: 189

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about autocomplete