|
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. |
@@ -35,37 +35,29 @@ public void defaults(RecipeSpec spec) { |
35 | 35 |
|
36 | 36 | @DocumentExample |
37 | 37 | @Test |
38 | | - void replaceSetsFilter() { |
| 38 | + void replaceCollections2Filter() { |
39 | 39 | //language=java |
40 | 40 | rewriteRun( |
41 | 41 | java( |
42 | 42 | """ |
43 | | - import java.util.ArrayList; |
44 | 43 | import java.util.Collection; |
45 | | - import java.util.Objects; |
46 | 44 |
|
47 | 45 | import com.google.common.base.Predicate; |
48 | 46 | import com.google.common.collect.Collections2; |
49 | 47 |
|
50 | 48 | class Test { |
51 | | - public static Collection<Object> test() { |
52 | | - Collection<Object> collection = new ArrayList<>(); |
53 | | - Predicate<Object> isNotNull = Objects::nonNull; |
| 49 | + Collection<Object> test(Collection<Object> collection, Predicate<Object> isNotNull) { |
54 | 50 | return Collections2.filter(collection, isNotNull); |
55 | 51 | } |
56 | 52 | } |
57 | 53 | """, |
58 | 54 | """ |
59 | | - import java.util.ArrayList; |
60 | 55 | import java.util.Collection; |
61 | | - import java.util.Objects; |
62 | 56 |
|
63 | 57 | import com.google.common.base.Predicate; |
64 | 58 |
|
65 | 59 | class Test { |
66 | | - public static Collection<Object> test() { |
67 | | - Collection<Object> collection = new ArrayList<>(); |
68 | | - Predicate<Object> isNotNull = Objects::nonNull; |
| 60 | + Collection<Object> test(Collection<Object> collection, Predicate<Object> isNotNull) { |
69 | 61 | return collection.stream().filter(isNotNull).toList(); |
70 | 62 | } |
71 | 63 | } |
|
0 commit comments