code: @SuppressWarnings("unchecked")
      private CompletionStage<List<V>> invokeMapBatchLoader(List<K> keys, BatchLoaderEnvironment environment) {
          CompletionStage<Map<K, V>> loadResult;
          Set<K> setOfKeys = new LinkedHashSet<>(keys);
          if (batchLoadFunction instanceof MappedBatchLoaderWithContext) {
              loadResult = ((MappedBatchLoaderWithContext<K, V>) batchLoadFunction).load(setOfKeys, environment);
          } else {
              loadResult = ((MappedBatchLoader<K, V>) batchLoadFunction).load(setOfKeys);
          }
          CompletionStage<Map<K, V>> mapBatchLoad = nonNull(loadResult, "Your batch loader function MUST return a non null CompletionStage promise");
          return mapBatchLoad.thenApply(map -> {
              List<V> values = new ArrayList<>();
              for (K key : keys) {
                  V value = map.get(key);
                  values.add(value);
              }
              return values;
          });
      }
docs: /*
  Turns a map of results that MAY be smaller than the key list back into a list by mapping null
  to missing elements.