class AsMap {

  @Udf
  public final <T> Map<String, T> asMap(
      @UdfParameter final List<String> keys,
      @UdfParameter final List<T> values) {
    final Map<String, T> map = new HashMap<>();
    for (int i = 0; i < keys.size(); i++) {
      final String key = keys.get(i);
      final T value = i >= values.size() ? null : values.get(i);

      map.put(key, value);
    }
    return map;
  }

}