code: @SuppressWarnings("unchecked")
    public static <T> T[] filter(T[] array, Filter<T> filter) {
  
      Assert.notNull(array, "Array is required");
      Assert.notNull(filter, "Filter is required");
  
      List<T> arrayList = stream(array).filter(filter::accept).collect(Collectors.toList());
  
      return arrayList.toArray((T[]) Array.newInstance(array.getClass().getComponentType(), arrayList.size()));
    }
docs: Filters the elements in the array.
  
  @param <T> Class type of the elements in the array.
  @param array array to filter.
  @param filter {@link Filter} used to filter the array elements.
  @return a new array of the array class component type containing only elements from the given array
  accepted by the {@link Filter}.
  @throws IllegalArgumentException if either the array or {@link Filter} are null.
  @see #filterAndTransform(Object[], FilteringTransformer)
  @see org.cp.elements.lang.Filter