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 8018321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:06:13+00:00 2026-06-04T21:06:13+00:00

I have a very large set of string URL patterns like {http://www.imdb.com, http://www.amazon.com ,…}

  • 0

I have a very large set of string URL patterns like {http://www.imdb.com, http://www.amazon.com,…} in a list.

I am getting input URL’s like this:

http://www.imdb.com/title/tt1409024/

For the purpose of my application this URL is actually formed from http://www.imdb.com, so the equality of these two should be true.

To implement this, I can extract the base URL from the input URL:

http://www.imdb.com/title/tt1409024/ => http://www.imdb.com

Now I need to compare this extracted URL with the master list of URLs and store the base URL in a database, if a match is found. So in essence, for each on of my input (base) URL’s, I am looking for a match in the master list for the extracted URL, and if a match is found I am storing the input (base) URL in the database.

To implement the equality/matching logic, I have two possible solutions. Please weigh in as to which is better:

  1. Put the master list of URL’s in an array list, and use the array list contains method
  2. Put the master list in a database, and use query to check the the input url against it

Can anyone tell me which one will be better in terms of performance?

  • 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-04T21:06:15+00:00Added an answer on June 4, 2026 at 9:06 pm

    Neither of your suggestions would be appropriate. For an ArrayList, you would have to search linearly through half the list (on average) for every URL you want to check.

    For a database (presumably on disk?), you would incur a potentially expensive database lookup for every query.

    1000 URL patterns isn’t very many. Keep the list in memory and use an appropriate data structure – a HashSet would do a good job.

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

Sidebar

Related Questions

I have a very large set of permissions in my application that I represent
I have a very large data set that I'm trying to find the smallest
I have a very large possible data set that I am trying to visualize
I have a very strange situation. I have a large set of records to
I have a UITextView with contentSize property set to a very large value 1000
I have a very large string that needs to escape all the single quotes
I have a very large (1.8GB) XML document. I'd like to simply find the
I have a very large XML file which has like 40000 data, and when
I have a query that returns a very large data set. I cannot copy
I have a very large set of binary files where several thousand raw frames

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.