Skip to content

Commit

Permalink
改进:CollectionUtil.filter() 的容量预初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
CodePlayer committed Nov 13, 2024
1 parent f43b6b4 commit bdd0b0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/me/codeplayer/util/CollectionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static <E> ArrayList<E> ofArrayList(E... elements) {
*/
public static <E> List<E> filter(final Collection<E> c, final Predicate<? super E> matcher) {
int size = c.size();
final List<E> list = new ArrayList<>(size);
final List<E> list = new ArrayList<>();
if (size > 0) {
for (E e : c) {
if (matcher.test(e)) {
Expand Down

0 comments on commit bdd0b0c

Please sign in to comment.