Tristan Caron
03/02/2018, 11:18 AM{
fields: [userId, contentId, clicks],
rows: [[1, 1, 456], [1, 2, 4543], [2, 3, 543]]
}
And to map them I do
val reportHeaderIndex = with(reportResult.fields) {
ReportHeaderIndex(
userId = indexOf("userId"),
contentId = indexOf("contentId"),
clicks = indexOf("clicks")
)
}
val reportHash = HashMap<Int, HashMap<Int, HashMap<String, List<Int>>>>()
reportResult.rows.forEach { row ->
reportHash
.getOrPut(row[reportHeaderIndex.userId] as Int, { HashMap() })
.getOrPut(row[reportHeaderIndex.contentId] as Int, { HashMap() })
.put(row[reportHeaderIndex.clicks] as Int, row)
}