public LinkedList<Map.Entry<String, V>> commonPrefixSearchWithValue(char[] keyChars, int begin)
    {
        int len = keyChars.length;
        LinkedList<Map.Entry<String, V>> result = new LinkedList<Map.Entry<String, V>>();
        int b = base[0];
        int n;
        int p;

        for (int i = begin; i < len; ++i)
        {
            p = b;
            n = base[p];
            if (b == check[p] && n < 0)         // base[p] == check[p] && base[p] < 0 查到一个词
            {
                result.add(new AbstractMap.SimpleEntry<String, V>(new String(keyChars, begin, i - begin), v[-n - 1]));
            }

            p = b + (int) (keyChars[i]) + 1;    // 状态转移 p = base[char[i-1]] + char[i] + 1
            // 下面这句可能产生下标越界，不如改为if (p < size && b == check[p])，或者多分配一些内存
            if (b == check[p])                  // base[char[i-1]] == check[base[char[i-1]] + char[i] + 1]
                b = base[p];
            else
                return result;
        }

        p = b;
        n = base[p];

        if (b == check[p] && n < 0)
        {
            result.add(new AbstractMap.SimpleEntry<String, V>(new String(keyChars, begin, len - begin), v[-n - 1]));
        }

        return result;
    }
public LinkedList < Map . Entry < String , V > > commonPrefixSearchWithValue ( char [ ] keyChars , int begin ) { int len = keyChars . length ; LinkedList < Map . Entry < String , V > > result = new LinkedList < Map . Entry < String , V > > ( ) ; int b = base [ 0 ] ; int n ; int p ; for ( int i = begin ; i < len ; ++ i ) { p = b ; n = base [ p ] ; if ( b == check [ p ] && n < 0 ) { result . add ( new AbstractMap . SimpleEntry < String , V > ( new String ( keyChars , begin , i - begin ) , v [ - n - 1 ] ) ) ; } p = b + ( int ) ( keyChars [ i ] ) + 1 ; if ( b == check [ p ] ) b = base [ p ] ; else return result ; } p = b ; n = base [ p ] ; if ( b == check [ p ] && n < 0 ) { result . add ( new AbstractMap . SimpleEntry < String , V > ( new String ( keyChars , begin , len - begin ) , v [ - n - 1 ] ) ) ; } return result ; }
优化的前缀查询，可以复用字符数组

@param keyChars
@param begin
@return