This commit is contained in:
Looly 2022-05-27 17:50:03 +08:00
parent b404b11b0b
commit 66fe842140
2 changed files with 4 additions and 4 deletions

View File

@ -941,7 +941,7 @@ public class CollUtil {
* @return 处理后的集合
* @since 4.6.5
*/
public static <T extends Collection<E>, E> T filter(final T collection, final Filter<E> filter) {
public static <T extends Collection<E>, E> T filter(final T collection, final Predicate<E> filter) {
return IterUtil.filter(collection, filter);
}

View File

@ -710,7 +710,7 @@ public class IterUtil {
* @return 编辑后的集合
* @since 4.6.5
*/
public static <T extends Iterable<E>, E> T filter(final T iter, final Filter<E> filter) {
public static <T extends Iterable<E>, E> T filter(final T iter, final Predicate<E> filter) {
if (null == iter) {
return null;
}
@ -734,13 +734,13 @@ public class IterUtil {
* @return 编辑后的集合
* @since 4.6.5
*/
public static <E> Iterator<E> filter(final Iterator<E> iter, final Filter<E> filter) {
public static <E> Iterator<E> filter(final Iterator<E> iter, final Predicate<E> filter) {
if (null == iter || null == filter) {
return iter;
}
while (iter.hasNext()) {
if (false == filter.accept(iter.next())) {
if (false == filter.test(iter.next())) {
iter.remove();
}
}