docs: @SuppressWarnings("unchecked")
  	public static <T extends ProgramElementDoc> T[] filter(Class<T> type, T[] original, boolean ignoreHidden, Filter<T> filter) {
  		final List<T> list = new ArrayList<>();
  		for (final T element : original) {
  			if (!ignoreHidden || !isHiddenMember(element.name())) {
  				final T newElement = filter.filter(element);
  				if (newElement != null) {
  					list.add(newElement);
  				}
  			}
  		}
  		final T[] result = (T[]) Array.newInstance(type, list.size());
  		list.toArray(result);
  		return result;
  	}