Interface Trie<V>


  • public interface Trie<V>
    A prefix tree that maps from the longest matching prefix to a value V.
    • Method Detail

      • builder

        static <V> Trie.Builder<V> builder()
        Start building a trie.
      • getOrNull

        @Nullable
        default V getOrNull​(CharSequence str)
        Returns the value associated with the longest matched prefix, or null if there wasn't a match. For example: for a trie containing an ("abc", 10) entry trie.getOrNull("abcd") will return 10.
      • getOrDefault

        V getOrDefault​(CharSequence str,
                       V defaultValue)
        Returns the value associated with the longest matched prefix, or the defaultValue if there wasn't a match. For example: for a trie containing an ("abc", 10) entry trie.getOrDefault("abcd", -1) will return 10.
      • contains

        default boolean contains​(CharSequence str)
        Returns true if this trie contains the prefix str.