class ArrayRemove {

  @Udf
  public <T> List<T> remove(
      @UdfParameter(description = "Array of values") final List<T> array,
      @UdfParameter(description = "Value to remove") final T victim) {
    if (array == null) {
      return null;
    }

    final List<T> result = array.stream()
        .filter(el -> !Objects.equals(el, victim))
        .collect(Collectors.toList());
    return result;
  }

}