Where do I find a standard Trie based map implementation in Java?

Uri picture Uri · Mar 8, 2009 · Viewed 37.4k times · Source

I have a Java program that stores a lot of mappings from Strings to various objects.

Right now, my options are either to rely on hashing (via HashMap) or on binary searches (via TreeMap). I am wondering if there is an efficient and standard trie-based map implementation in a popular and quality collections library?

I've written my own in the past, but I'd rather go with something standard, if available.

Quick clarification: While my question is general, in the current project I am dealing with a lot of data that is indexed by fully-qualified class name or method signature. Thus, there are many shared prefixes.

Answer

David Schlosnagle picture David Schlosnagle · Mar 8, 2009

You might want to look at the Trie implementation that Limewire is contributing to the Google Guava.