package com.google.sps.data;

import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.collections4.keyvalue.MultiKey;

/*
 * Class representing one row/entry in the aggregation response.  A NULL field value
 * means the field was not being aggregated by, and will be omitted from the JSON response
*/
public final class AggregationResponseEntry {

  private String assetId;
  private String location;
  private String user;
  private final int count;

  public AggregationResponseEntry(MultiKey key, int count, Set<AnnotatedField> fields) {

    String keys[] = (String[]) key.getKeys();
    int currKey = 0;

    Iterator<AnnotatedField> it = fields.iterator();
    while (it.hasNext()) {
      switch(it.next()) {
        case ASSET_ID:
          this.assetId = keys[currKey++];
          break;
        case LOCATION:
          this.location = keys[currKey++];
          break;
        case USER:
          this.user = keys[currKey++];
          break;
      }
    }

    this.count = count;
  }
}

@@ -401,16 +401,25 @@
 String a
+nnotatedA
 ssetId;%0A
@@ -435,17 +435,26 @@
  String 
-l
+annotatedL
 ocation;
@@ -471,17 +471,26 @@
  String 
-u
+annotatedU
 ser;%0A  p
@@ -817,16 +817,25 @@
   this.a
+nnotatedA
 ssetId =
@@ -844,32 +844,32 @@
 eys%5BcurrKey++%5D;%0A
-
           break;
@@ -907,17 +907,26 @@
    this.
-l
+annotatedL
 ocation 
@@ -995,17 +995,26 @@
    this.
-u
+annotatedU
 ser = ke

Refactor output format to be same as input format, standardizing the API