MAXGEN
MAXGEN

Reputation: 755

What type of datastructure to use with this type of data format?

The following is the example of structure of data I'm working with -


    {
        {DATA IDX1 -> {INFO ID1, INFO ID2,  INFO ID3}}, 
        {DATA IDX2 -> {INFO ID1, INFO ID2}}, 
        {DATA IDX3 -> {INFO ID5, INFO ID6}}, 
        // etc...
    }

I can't figure out which one will be most suitable. I might go with the one I can implement first.

Should I use ArrayList, List, LinkedList or HashMap with a list?

Upvotes: 1

Views: 63

Answers (1)

Abhilash Divakaran
Abhilash Divakaran

Reputation: 4227

I would use

Hashmap <String, List<Object>> dataMap;

So that you get a list of objects when you use the statement

dataMap.get("DATA ID1");

You can go through the List items to find out the type and process the data accordingly.

Upvotes: 1

Related Questions