0

I have A List of Map of List for Eg. as Below

 List<List<Integer>> pageData = new ArrayList<>();
 List<Map<String,List<String>>> curPage = new ArrayList<>();
 Map curpage1=new HashMap<>();
 List curpage1list = new ArrayList<String>();
 curpage1list.add("page1d");curpage1list.add("page1d1");
 curpage1.put("curpage1", curpage1list);

 Map curpage2=new HashMap<>();
 List curpage2list = new ArrayList<String>();
 curpage2list.add("page2d");curpage2list.add("page2d1");
 curpage2.put("curpage2", curpage2list);

 Map curpage3=new HashMap<>();
 List curpage3list = new ArrayList<String>();
 curpage3list.add("page3d");curpage3list.add("page3d1");
 curpage3.put("curpage3", curpage3list);

 curPage.add(curpage1);curPage.add(curpage2);curPage.add(curpage3);

The Output of These above insertion is something like this:

[{curpage1=[page1d, page1d1]}, {curpage2=[page2d, page2d1]}, {curpage3=[page3d, page3d1]}]

Sorry for the untidy ones.

I need to get a below result based on the index of the lists of each key of the Map as List of List of Integers as below.

[0,0,0] //nothing but index of [page1d,page2d,page3d]
[0,0,1] //nothing but index of [page1d,page2d,page3d1]
[0,1,0] //nothing but index of [page1d,page2d1,page3d]
[0,1,1] //nothing but index of [page1d,page2d1,page3d1]

Ones the 0th element of First list is done for next elements I need only

[1,0,0] ////nothing but index of [page1d1,page2d,page3d]
...[n,0,0]

This can change upto n Elements i.e [0,0,.....n]

Need a help on this. I'm sorry for a bad framing of Question otherwise. I tried my best

Garry Steve
  • 129
  • 2
  • 11
  • I'd consider it a bad design if you're using collections this way. Java's an object oriented language. See if you can conceive of an Object that would encapsulate what you want so you can create a List of them and manipulate them appropriately. – duffymo Mar 27 '18 at 15:01
  • Are you looking for help generating cartesian combinations for a given `n`? I am not certain what your exact question is? – Ian Mc Mar 27 '18 at 15:49

0 Answers0