private void apply_helper(byte[] buff_, int buffsize_, int maxbuffsize_, ITrieHandler func_,
            Object arg_) {
        //  If this node is a subscription, apply the function.
        if (refcnt > 0)
            func_.added (buff_, buffsize_, arg_);

        //  Adjust the buffer.
        if (buffsize_  >= maxbuffsize_) {
            maxbuffsize_ = buffsize_  + 256;
            buff_ = Utils.realloc (buff_, maxbuffsize_);
            assert (buff_!=null);
        }

        //  If there are no subnodes in the trie, return.
        if (count == 0)
            return;

        //  If there's one subnode (optimisation).
        if (count == 1) {
            buff_ [buffsize_] = min;
            buffsize_++;
            next[0].apply_helper (buff_, buffsize_, maxbuffsize_, func_, arg_);
            return;
        }
        
        //  If there are multiple subnodes.
        for (short c = 0; c != count; c++) {
            buff_ [buffsize_] = (byte) (min + c);
            if (next[c] != null)
                next[c].apply_helper (buff_, buffsize_ + 1, maxbuffsize_,
                    func_, arg_);
        }
    }