|
1 | 1 | /* |
2 | | - * Copyright 2024 the original author or authors. |
| 2 | + * Copyright 2025 the original author or authors. |
3 | 3 | * <p> |
4 | 4 | * Licensed under the Moderne Source Available License (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -40,33 +40,25 @@ void replaceSetsFilter() { |
40 | 40 | rewriteRun( |
41 | 41 | java( |
42 | 42 | """ |
43 | | - import java.util.HashSet; |
44 | | - import java.util.Objects; |
45 | 43 | import java.util.Set; |
46 | 44 |
|
47 | 45 | import com.google.common.base.Predicate; |
48 | 46 | import com.google.common.collect.Sets; |
49 | 47 |
|
50 | 48 | class Test { |
51 | | - public static Set<Object> test() { |
52 | | - Set<Object> set = new HashSet<>(); |
53 | | - Predicate<Object> isNotNull = Objects::nonNull; |
| 49 | + public static Set<Object> test(Set<Object> set, Predicate<Object> isNotNull) { |
54 | 50 | return Sets.filter(set, isNotNull); |
55 | 51 | } |
56 | 52 | } |
57 | 53 | """, |
58 | 54 | """ |
59 | | - import java.util.HashSet; |
60 | | - import java.util.Objects; |
61 | 55 | import java.util.Set; |
62 | 56 | import java.util.stream.Collectors; |
63 | 57 |
|
64 | 58 | import com.google.common.base.Predicate; |
65 | 59 |
|
66 | 60 | class Test { |
67 | | - public static Set<Object> test() { |
68 | | - Set<Object> set = new HashSet<>(); |
69 | | - Predicate<Object> isNotNull = Objects::nonNull; |
| 61 | + public static Set<Object> test(Set<Object> set, Predicate<Object> isNotNull) { |
70 | 62 | return set.stream().filter(isNotNull).collect(Collectors.toSet()); |
71 | 63 | } |
72 | 64 | } |
|
0 commit comments