Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9134687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:42:28+00:00 2026-06-17T08:42:28+00:00

I have a large amount of Key-Value parameters that map to a file path.

  • 0

I have a large amount of Key-Value parameters that map to a file path. Most have the following form

filepath : /some/path
param_name_1 => 1234
param_name_2 => qwerty

But others can contain wildcard characters

filepath : /other/path
param_name_1 => 123*4
param_name_2 => ab?12

Where the ? is a wildcard matching any one character and * is a wildcard matching 0+ characters.

My users can provide their own set of KV parameters which I have to match and return the mapped path.

Example: User provides

param_name_1 => 1234
param_name_2 => qwerty

Application returns /some/path

User provides

param_name_1 => 123asdqweqweqdqweq1231asdcase4
param_name_2 => abW12

Application returns /other/path

For all the mappings that don’t contain wildcards, I can compute hashCode() for my stored mapping and for the user-provided one and do a HashMap lookup which is extremely fast (3-4 parameters to match, 100000 mappings, in 0 milliseconds, it’s a hash after all).

For mappings that contain wildcards though, I’m kind of stuck with doing linear look-ups through a list of all mappings that contain wildcards. There are about 2000-5000 such mappings and each look-up takes just under 200 milliseconds and I need to speed it up.

Is there a way I can do a general look-up to match wildcards or some other matching technique that would combine all mappings?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:42:29+00:00Added an answer on June 17, 2026 at 8:42 am

    If you use a TreeMap instead of a HashMap, you can do a prefix search to reduce the number of items you have to iterate through. Just grab the characters that appear before the * or ?, and iterate through all keys that start with those characters. This won’t work, of course, if your search term starts with a wildcard.

    The other common approach to this problem is to use character ngrams or some trie-based structure, but that’s a lot more complicated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a data model that contains large amount of columns in few key
I need some help in solving this problem. We have a large amount of
I have a rather large amount of data (100 MB or so), that I
I have a WCF service that can return large amount of data depending on
I have a highly formatted file with large amount of data which I used
I have a windows service that receives a large amount of data that needs
I need to create a function which will have large amount of parameters can
I have a large amount of static data that needs to offer random access.
I have a stored procedure that is working with a large amount of data.
I have the following code, in which I’m trying to process a large amount

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.