Skip to content

Commit

Permalink
[22] coll3's ListUtils.EMPTY_LIST -> to java's Collections.emptyList (#…
Browse files Browse the repository at this point in the history
…23)

#22

Co-authored-by: Samuel Cox <[email protected]>
  • Loading branch information
crankydillo and Samuel Cox authored Aug 6, 2024
1 parent 75ca72c commit db959db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ recipeList:
oldFieldName: EMPTY_MAP
newClassName: java.util.Collections
newMethodName: emptyMap
- org.openrewrite.java.ChangeStaticFieldToMethod:
oldClassName: org.apache.commons.collections.ListUtils
oldFieldName: EMPTY_LIST
newClassName: java.util.Collections
newMethodName: emptyList
- org.openrewrite.java.ChangePackage:
oldPackageName: org.apache.commons.collections
newPackageName: org.apache.commons.collections4
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ void apacheCommonsCollections() {
"""
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.IdentityMap;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.collections.FastArrayList;
import java.util.List;
import java.util.Map;
class Test {
Expand All @@ -58,6 +60,7 @@ static void helloApacheCollections() {
IdentityMap identityMap = new IdentityMap();
Map emptyMap = MapUtils.EMPTY_MAP;
FastArrayList fastList = new FastArrayList(100);
List emptyList = ListUtils.EMPTY_LIST;
}
}
""",
Expand All @@ -66,6 +69,7 @@ static void helloApacheCollections() {
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
Expand All @@ -76,6 +80,7 @@ static void helloApacheCollections() {
IdentityHashMap identityMap = new IdentityHashMap();
Map emptyMap = Collections.emptyMap();
CopyOnWriteArrayList fastList = new CopyOnWriteArrayList(100);
List emptyList = Collections.emptyList();
}
}
"""
Expand Down

0 comments on commit db959db

Please sign in to comment.