0

I have a list of two hash maps with the same set of keys but different values.

Map<String, String> map1 = new HashMap<>();
map1.put("t1", "val1");
map1.put("t2", "val2");
map1.put("t3", "val3");

Map<String, String> map2 = new HashMap<>();
map2.put("t1", "str1");
map2.put("t2", "str2");
map2.put("t3", "str3");

I want to generate an excel sheet such that the keys will be in the header row, and all values will come under it as below:

t1     t2   t3
val1   val2 val3
str1   str2 str3

Can anyone suggest a way out of it?

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
user2755407
  • 348
  • 1
  • 3
  • 15
  • 6
    Too broad (needs details or clarity, includes multiple questions). Where exactly are you stuck? – knittl Oct 06 '22 at 12:20
  • 3
    [_How do I efficiently iterate over each entry in a Java Map?_](https://stackoverflow.com/q/46898/230513) or [_How do I write a spreadsheet?_](https://stackoverflow.com/search?tab=votes&q=%5bapache-poi%5d%20write%20spreadsheet) – trashgod Oct 06 '22 at 12:31

0 Answers0