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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:31:30+00:00 2026-06-07T05:31:30+00:00

I need to store certain id’s , and check if one exists there. Either

  • 0

I need to store certain id’s , and check if one exists there.
Either i can use concatenated string or array/List, which of them is a better and faster way.
This is how actually data is organized :

  • Year 1
    • Month 1
      • Day 1
      • Day 2
      • Day 3
    • Month 2
      • Day 6
      • Day 2
      • Day 3
  • Year 2
    • Month 3
      • Day 1
      • Day 3
      • Day 7
    • Month 6
      • Day 6
      • Day 2
      • Day 3
  • 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-07T05:31:31+00:00Added an answer on June 7, 2026 at 5:31 am

    I would definitely use a collection of some form. If you only care about containment, you should use a Set<String> of some kind (e.g. HashSet<String> or LinkedHashSet<String>, which will both give O(1) complexity unless you have a significant number of hash collisions) but for goodness’ sake don’t use a concatenated string.

    Your data isn’t naturally a concatenated string – it’s a collection of strings. Always keep your data in the most natural representation unless you have really good evidence that some alternative form (such as a single string) will bring you a meaningful benefit. Keeping your data in a natural representation almost always leads to clearer code which is easier to work with – and easier to optimize later, when you’ve found where the real bottlenecks are.

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

Sidebar

Related Questions

I have a use case where I only need to store certain fields to
I have the need to store a list/collection/array of dynamically created objects of a
I need to store a char array inside a class and then return it.
I'm working on a small online game where there is a need to store
I'm developing code using jQuery and need to store data associated with certain DOM
With FastMM4 one can easily register a leaked pointer, but not a leaked string.
I need to store certain information while my application is executing and again fetch
I have id values for products that I need store. Right now they are
I need to store various info about some movies, books, games, and maybe other
I need to store IP address in the most compact way possible, searching is

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.