The situation occurs when getting some data from the database to compose a report that is grouped by various fields. For example, grouped by month, then type and then actual vs prediction. The database query returns simply a List< Object[] >. But it is boring to directly render it as an HTML table. What I do is to group the data inside a Map<Integer, Map<String, Map<Type, Integer>>>. It can be done in a straightforward way and if I use TreeMap's, the data is automatically sorted for me. The resulting JSP code is much simpler.
Is there any problem with this approach? (memory, speed, or something else?)