public static void addValues( List<List<String>> ids, Grid grid, Grid outputGrid ) { Map<String, Object> valueMap = getAggregatedEventDataMapping( grid ); boolean hasValues = false; for ( List<String> idList : ids ) { Collections.sort( idList ); String key = StringUtils.join( idList, DIMENSION_SEP ); Object value = valueMap.get( key ); hasValues = hasValues || value != null; outputGrid.addValue( value ); } if ( !hasValues ) { outputGrid.removeCurrentWriteRow(); } } }