code: public static <T, R extends Collection<T>, E extends Exception> R filter(final T[] a, final int fromIndex, final int toIndex,
              final Try.Predicate<? super T, E> filter, final int max, final IntFunction<R> supplier) throws E {
          checkFromToIndex(fromIndex, toIndex, len(a));
          N.checkArgNotNull(filter);
  
          if (N.isNullOrEmpty(a)) {
              return supplier.apply(0);
          }
  
          final R result = supplier.apply(N.min(9, max, (toIndex - fromIndex)));
  
          for (int i = fromIndex, cnt = 0; i < toIndex && cnt < max; i++) {
              if (filter.test(a[i])) {
                  result.add(a[i]);
                  cnt++;
              }
          }
  
          return result;
      }
docs: Mostly it's designed for one-step operation to complete the operation in one step.
  <code>java.util.stream.Stream</code> is preferred for multiple phases operation.
  
  @param a
  @param fromIndex
  @param toIndex
  @param filter
  @param max
  @param supplier
  @return