public static <R> R findFirst(final List<R> list, final Function<R, Boolean> function) {
        if (CollectionUtils.isEmpty(list)) {
            return null;
        }
        return list.stream().filter(r -> Boolean.TRUE.equals(function.apply(r))).findFirst().orElse(null);
    }
list map.<br>
if element is null it filter.

@param list     list
@param function map fun
@param <R>      resource type
@return list
shenyu-common/src/main/java/org/apache/shenyu/common/utils/ListUtil.java