mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java: When generating return statement where the returned type is an array suggest Collection.toArray() if there's no better option (IDEA-163341)
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
// "Add 'return' statement" "true"
|
||||
import java.util.*;
|
||||
class T {
|
||||
String[] f() {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("a");
|
||||
return <caret><selection>list.toArray(new String[0])</selection>;
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Add 'return' statement" "true"
|
||||
import java.util.*;
|
||||
class T {
|
||||
Object[] f() {
|
||||
Set set = new HashSet();
|
||||
set.add("a");
|
||||
return <caret><selection>set.toArray()</selection>;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Add 'return' statement" "true"
|
||||
import java.util.*;
|
||||
class T {
|
||||
A[] f() {
|
||||
Queue<B> queue = new ArrayDeque<>();
|
||||
queue.add(new B());
|
||||
return <caret><selection>queue.toArray(new A[0])</selection>;
|
||||
}
|
||||
}
|
||||
class A {}
|
||||
class B extends A {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Add 'return' statement" "true"
|
||||
import java.util.*;
|
||||
class T {
|
||||
String[] f() {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("a");
|
||||
<caret>}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Add 'return' statement" "true"
|
||||
import java.util.*;
|
||||
class T {
|
||||
Object[] f() {
|
||||
Set set = new HashSet();
|
||||
set.add("a");
|
||||
<caret>}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Add 'return' statement" "true"
|
||||
import java.util.*;
|
||||
class T {
|
||||
A[] f() {
|
||||
Queue<B> queue = new ArrayDeque<>();
|
||||
queue.add(new B());
|
||||
<caret>}
|
||||
}
|
||||
class A {}
|
||||
class B extends A {}
|
||||
Reference in New Issue
Block a user