-
March 7th, 2024, 12:08 PM
#1
Which data structure to use
I have the following structure of data I need to store and fetch in a Java class:
ID Address 1 Address 2 Address 3 ....
--------------- -------------- ------------------ --------------
3482f899bbs7293 Address line 1 Address line 2 ... ...
3482f899bbs7293 Address line 1 Address line 2 ... ...
This needs to be a data type or custom class in a ScenarioState object, so that I can add entries - first the initial line with the ID and an address, and then later add more adress lines to a specific ID. Then I need to be able to fetch the address line(s) for a specific ID.
Basically, a very simple database table. But using a database just for this one thing is out of the question.
Is the best method just using a List with the ID as the first entry, and then use Streams (or loops for that matter) to fetch the information? Or is are there more elegant ways to do it?
All suggestions are appreciated.
This might be very basic, and in that case I apologize. And if the question should be posted somewhere else, please tell me and I'll remove it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|