How can I iterate a hashmap which contains a dto class as the value for the key?
<p>I'm trying to get the values of the <code>keyset()</code> of a <code>hashmap</code> and print those into an excel sheet. And this is how my <code>hashmap</code> looks like:</p>

<pre><code>public Map&lt;String, CodaReportDTO&gt; dateAndDTO = new HashMap&lt;&gt;(); //hashmap for date and the dto
</code></pre>

<p>So in the above, <code>CodaReportDTO</code> contains elements for a particular date. So I tried iterating the <code>hashmap keyset</code> like this in order to print the dates first:</p>

<pre><code>    for (String dateKey : dateAndDTO.keySet()) { //dateAndDTO is the object

            Row tableDataRow = sheet.createRow(tableDataRowCount);
            Cell cell = tableDataRow.createCell(1);
            cell.setCellValue(dateKey);
    }
</code></pre>

<p>So in order to iterate and get the values of a key (in other words, the values for the date), it should be either a <code>List</code> or a <code>Map</code>. How can I do this for a <code>hashmap</code> which contains a <code>DTO</code> class?</p>

<p>I have to do something like this but couldn't cast the class in to a <code>List</code>:</p>

<pre><code>List&lt;Map&lt;String, String&gt;&gt; tableCellData = (List&lt;Map&lt;String, String&gt;&gt;) dateAndDTO.get(dateKey);
        for (Map&lt;String, String&gt; singleCellTableData : tableCellData) {
            int dateCellRef = dateCellReferences.get(singleCellTableData.keySet().iterator().next());
            Cell tableCell = tableDataRow.createCell(dateCellRef);
            tableCell.setCellValue(Integer.parseInt(singleCellTableData.values().iterator().next()));
        }
</code></pre>

<p><strong>EDIT</strong></p>

<p>The DTO class is available <a href="http://pastebin.com/m5PNzVfN" rel="nofollow">here</a>.</p>

<p>Where am I going wrong? Any help could be appreciated.</p>