docs: public static Map<String, Object> compact(Object input, Object context, JsonLdOptions opts)
              throws JsonLdError {
          // 1)
          // TODO: look into java futures/promises
  
          // 2-6) NOTE: these are all the same steps as in expand
          final Object expanded = expand(input, opts);
          // 7)
          if (context instanceof Map
                  && ((Map<String, Object>) context).containsKey(JsonLdConsts.CONTEXT)) {
              context = ((Map<String, Object>) context).get(JsonLdConsts.CONTEXT);
          }
          Context activeCtx = new Context(opts);
          activeCtx = activeCtx.parse(context);
          // 8)
          Object compacted = new JsonLdApi(opts).compact(activeCtx, null, expanded,
                  opts.getCompactArrays());
  
          // final step of Compaction Algorithm
          // TODO: SPEC: the result result is a NON EMPTY array,
          if (compacted instanceof List) {
              if (((List<Object>) compacted).isEmpty()) {
                  compacted = newMap();
              } else {
                  final Map<String, Object> tmp = newMap();
                  // TODO: SPEC: doesn't specify to use vocab = true here
                  tmp.put(activeCtx.compactIri(JsonLdConsts.GRAPH, true), compacted);
                  compacted = tmp;
              }
          }
          if (compacted != null && context != null) {
              // TODO: figure out if we can make "@context" appear at the start of
              // the keySet
              if ((context instanceof Map && !((Map<String, Object>) context).isEmpty())
                      || (context instanceof List && !((List<Object>) context).isEmpty())) {
  
                  if (context instanceof List && ((List<Object>) context).size() == 1
                          && opts.getCompactArrays()) {
                      ((Map<String, Object>) compacted).put(JsonLdConsts.CONTEXT,
                              ((List<Object>) context).get(0));
                  } else {
                      ((Map<String, Object>) compacted).put(JsonLdConsts.CONTEXT, context);
                  }
              }
          }
  
          // 9)
          return (Map<String, Object>) compacted;
      }