@Udf(description = "When transforming an array, "
      + "the function provided must have two arguments. "
      + "The two arguments for each function are in order: " 
      + "the key and then the value. "
      + "The transformed array is returned."
  )
  public <T, R> List<R> transformArray(
      @UdfParameter(description = "The array") final List<T> array,
      @UdfParameter(description = "The lambda function") final Function<T, R> function
  ) {
    if (array == null || function == null) {
      return null;
    }
    return array.stream().map(function).collect(Collectors.toList());
  }
@Test
  public void shouldReturnTransformedArray() {
    assertThat(udf.transformArray(Collections.emptyList(), function1()), is(Collections.emptyList()));
    assertThat(udf.transformArray(Arrays.asList(-5, -2, 0), function1()), is(Arrays.asList(0, 3, 5)));

    assertThat(udf.transformArray(Collections.emptyList(), function2()), is(Collections.emptyList()));
    assertThat(udf.transformArray(Arrays.asList(-5, -2, 0), function2()), is(Arrays.asList("odd", "even", "even")));

    assertThat(udf.transformArray(Collections.emptyList(), function3()), is(Collections.emptyList()));
    assertThat(udf.transformArray(Arrays.asList("steven", "leah"), function3()), is(Arrays.asList("hello steven", "hello leah")));

    assertThat(udf.transformArray(Collections.emptyList(), function4()), is(Collections.emptyList()));
    assertThat(udf.transformArray(Arrays.asList(Arrays.asList(5, 4 ,3), Collections.emptyList()), function4()), is(Arrays.asList(3, 0)));
  }