docs: public SimpleOrderedMap<Object> create(ComponentList list, Boolean encode) {
      SimpleOrderedMap<Object> mtasListResponse = new SimpleOrderedMap<>();
      mtasListResponse.add("key", list.key);
      if (list.number == 0) {
        mtasListResponse.add("total", list.total);
      }
      if (list.output != null) {
        ArrayList<NamedList<Object>> mtasListItemResponses = new ArrayList<>();
        if (list.output.equals(ComponentList.LIST_OUTPUT_HIT)) {
          mtasListResponse.add("number", list.hits.size());
          for (ListHit hit : list.hits) {
            NamedList<Object> mtasListItemResponse = new SimpleOrderedMap<>();
            mtasListItemResponse.add("documentKey",
                list.uniqueKey.get(hit.docId));
            mtasListItemResponse.add("documentHitPosition", hit.docPosition);
            mtasListItemResponse.add("documentHitTotal",
                list.subTotal.get(hit.docId));
            mtasListItemResponse.add("documentMinPosition",
                list.minPosition.get(hit.docId));
            mtasListItemResponse.add("documentMaxPosition",
                list.maxPosition.get(hit.docId));
            mtasListItemResponse.add("startPosition", hit.startPosition);
            mtasListItemResponse.add("endPosition", hit.endPosition);
  
            SortedMap<Integer, List<List<String>>> hitData = new TreeMap<>();
            SortedMap<Integer, List<List<String>>> leftData = null;
            SortedMap<Integer, List<List<String>>> rightData = null;
            if (list.left > 0) {
              leftData = new TreeMap<>();
            }
            if (list.right > 0) {
              rightData = new TreeMap<>();
            }
            for (int position = Math.max(0,
                hit.startPosition - list.left); position <= (hit.endPosition
                    + list.right); position++) {
              List<List<String>> hitDataItem = new ArrayList<>();
              if (hit.hits.containsKey(position)) {
                for (String term : hit.hits.get(position)) {
                  List<String> hitDataSubItem = new ArrayList<>();
                  hitDataSubItem.add(CodecUtil.termPrefix(term));
                  hitDataSubItem.add(CodecUtil.termValue(term));
                  hitDataItem.add(hitDataSubItem);
                }
              }
              if (position < hit.startPosition) {
                if (leftData != null) {
                  leftData.put(position, hitDataItem);
                }
              } else if (position > hit.endPosition) {
                if (rightData != null) {
                  rightData.put(position, hitDataItem);
                }
              } else {
                hitData.put(position, hitDataItem);
              }
            }
            if (list.left > 0) {
              mtasListItemResponse.add("left", leftData);
            }
            mtasListItemResponse.add("hit", hitData);
            if (list.right > 0) {
              mtasListItemResponse.add("right", rightData);
            }
            mtasListItemResponses.add(mtasListItemResponse);
          }
        } else if (list.output.equals(ComponentList.LIST_OUTPUT_TOKEN)) {
          mtasListResponse.add("number", list.tokens.size());
          for (ListToken tokenHit : list.tokens) {
            NamedList<Object> mtasListItemResponse = new SimpleOrderedMap<>();
            mtasListItemResponse.add("documentKey",
                list.uniqueKey.get(tokenHit.docId));
            mtasListItemResponse.add("documentHitPosition", tokenHit.docPosition);
            mtasListItemResponse.add("documentHitTotal",
                list.subTotal.get(tokenHit.docId));
            mtasListItemResponse.add("documentMinPosition",
                list.minPosition.get(tokenHit.docId));
            mtasListItemResponse.add("documentMaxPosition",
                list.maxPosition.get(tokenHit.docId));
            mtasListItemResponse.add("startPosition", tokenHit.startPosition);
            mtasListItemResponse.add("endPosition", tokenHit.endPosition);
  
            ArrayList<NamedList<Object>> mtasListItemResponseItemTokens = new ArrayList<>();
            for (MtasToken token : tokenHit.tokens) {
              NamedList<Object> mtasListItemResponseItemToken = new SimpleOrderedMap<>();
              if (token.getId() != null) {
                mtasListItemResponseItemToken.add("mtasId", token.getId());
              }
              mtasListItemResponseItemToken.add("prefix", token.getPrefix());
              mtasListItemResponseItemToken.add("value", token.getPostfix());
              if (token.getPositionStart() != null) {
                mtasListItemResponseItemToken.add("positionStart",
                    token.getPositionStart());
                mtasListItemResponseItemToken.add("positionEnd",
                    token.getPositionEnd());
              }
              if (token.getPositions() != null) {
                mtasListItemResponseItemToken.add("positions",
                    Arrays.toString(token.getPositions()));
              }
              if (token.getParentId() != null) {
                mtasListItemResponseItemToken.add("parentMtasId",
                    token.getParentId());
              }
              if (token.getPayload() != null) {
                mtasListItemResponseItemToken.add("payload", token.getPayload());
              }
              if (token.getOffsetStart() != null) {
                mtasListItemResponseItemToken.add("offsetStart",
                    token.getOffsetStart());
                mtasListItemResponseItemToken.add("offsetEnd",
                    token.getOffsetEnd());
              }
              if (token.getRealOffsetStart() != null) {
                mtasListItemResponseItemToken.add("realOffsetStart",
                    token.getRealOffsetStart());
                mtasListItemResponseItemToken.add("realOffsetEnd",
                    token.getRealOffsetEnd());
              }
              mtasListItemResponseItemTokens.add(mtasListItemResponseItemToken);
            }
            mtasListItemResponse.add("tokens", mtasListItemResponseItemTokens);
            mtasListItemResponses.add(mtasListItemResponse);
          }
        }
        mtasListResponse.add(NAME, mtasListItemResponses);
      }
      return mtasListResponse;
    }