Randy Gettman - 2014-11-14

First, jAgg operates on Lists of Java objects. So you will need to extract the List out of your Map.

Then you can supply a List of properties and a List of AggregateFunctions to an Aggregation object.

Create a List of properties, assuming that your value object has getter methods such as getMonth(), getHowCold(), etc.

List<String> properties = Arrays.asList("month", "howCold");

Create your list of aggregate operations you'd like to perform.

List<AggregateFunction> aggs = new ArrayList<AggregateFunction>();
aggs.add(new CountAggregator("*"));

and/or

aggs.add(new AvgAggregator("temperature"));

Build your Aggregation object, which is what will perform the actual calculations.

Aggregation agg = new Aggregation.Builder()
   .setAggregators(aggs)
   .setProperties(properties)
   .build();

Perform the operations.

List<AggregateValue<YourType>> aggValues = agg.groupBy(yourList);

Then you can loop through the List of AggregateValue, calling getObject() to access the group-by category values and getAggregateValue(int index) to access the aggregate values.

The following documentation pages may provide further help:

Please reply back if you have any further questions about using jAgg.