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

  • Home
  • SEARCH
  • 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 6845225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:28:28+00:00 2026-05-27T00:28:28+00:00

I am learning Java and have a pretty basic problem. I am indexing some

  • 0

I am learning Java and have a pretty basic problem.

I am indexing some sites with a BufferedReader and storing the data in a MySQL-base. I do this for 30 sources every 15 seconds, which generate a lot of data.

Now I want to analyze this data. I am thinking of storing the data simultaneously in a HashMap which I will clear at the end of the day, every day.

But can you give me an example on how to create an object for 30 different sources?
Do I need 30 different HashMap or can I build a key like ‘pathName+randomNumber’?

In the end I want to be able to locate the first entry in the HashMap for each source and the two latest entries thereby enabling me to see what the difference between these three are.

Please help. I have tried to look on the web but with no luck as I think the HashMap examples are always focused towards storing Objects, but not on how to create the objects you store in them… (yeah I know – it’s a rookie question) 😉

  • 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-05-27T00:28:28+00:00Added an answer on May 27, 2026 at 12:28 am

    Jobu, I would do exactly as you proposed. So in a sense you answered your question already. 🙂 Whenever I had a similar situation, and had to use a Map, I use forward slashes to form a hierarchy of objects. So, say you want to distinguish data that come from 30 sources as you say. – Give those sources a unique name, and form your Map keys using this simple pattern: “/<root>/<source id>/<data id>” . Example of storing a link on some website: mymap.put("/myproject/www.example.com/link-0121", "http://www.kernel.org");

    If, for some reason you want to get all Map entries that have keys equal to “/myproject/www.example.com“, then I suggest you List objects only to your map! Here is a pseudo-code for that case:

    ArrayList lst = new ArrayList();
    lst.add("http://www.kernel.org");
    mymap.put("/myproject/www.example.com", lst); // www.example.com has a link to www.kernel.org
    

    This approach works only if your data can be uniquely identified by a number. Then you simply use List’s get() method which has index as parameter.

    However, if you need to have string keys for data, I am afraid you need to make Map of Maps (ie. use HashMap instead of the ArrayList).

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

Sidebar

Related Questions

I am currently learning about basic networking in java. I have been playing around
I'm learning android but have a pretty fair background in java so am a
I have been learning Java and have had no problem with projects in which
I'm learning Java and I have a problem. I created 6 different classes, each
I have been learning java spring hibernate MVC for 3 months and got pretty
I'm learning Java and I have no idea how to do this. I dragged
I have recently started learning Java EE 6 and I could need some help.
im currently learning stacks in java and have a quick question. what will the
I am learning Java and just found that the Interface can have fields, which
So I'm learning java, and I have a question. It seems that the types

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.