0

How can I take the information stored in a HashMap<Integer, ArrayList<Integer>> and create unique arrays of values. I do not need them in reverse order or any other ordering.

For example, assuming I have:

Key      Value
---      ---------
1        {1, 2, 3}
2        {10, 11}
3        {29}

How can I turn this into the following:

{1, 10, 29}
{1, 11, 29}
{2, 10, 29}
{2, 11, 29}
{3, 10, 29}
{3, 11, 29}

Ive tried a variety of loops. I also pondered tail end recursion however it still has me stumped. I would appreciate your guidance so I may solve this.

What my goal is: The key value is the primary key for an attribute. Each attribute has options which are contained in the value. I would like to restructure the information so it fits the format shown.

medokr
  • 441
  • 1
  • 5
  • 16

0 Answers0