CollectionUtils#isCollectionOrMapSize

Used in ToArrayCallWithZeroLengthArrayArgumentInspection and StreamApiMigrationInspection
This commit is contained in:
Tagir Valeev
2018-01-30 10:59:12 +07:00
parent abd1458307
commit 3210510c96
9 changed files with 114 additions and 28 deletions

View File

@@ -0,0 +1,10 @@
// "Replace with toArray" "true"
import java.util.*;
import java.util.stream.IntStream;
public class Main {
public String[] test(Map<String, String> map) {
String[] array = IntStream.range(0, map.size()).mapToObj(String::valueOf).toArray(String[]::new);
return array;
}
}

View File

@@ -0,0 +1,12 @@
// "Replace with toArray" "true"
import java.util.*;
public class Main {
public String[] test(Map<String, String> map) {
String[] array = new String[map.size()];
for(int<caret> i=0; i<map.keySet().size(); i++) {
array[i] = String.valueOf(i);
}
return array;
}
}