mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IterableUsedAsVararg: fixes according to review IDEA-CR-45949
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
// "Call 'toArray(new String[0])'" "true"
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
class Test {
|
||||
static <T> boolean contains(T needle, T... haystack) {
|
||||
for (final T t : haystack) {
|
||||
if (Objects.equals(t, needle)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static <T> boolean contains(String needle, String... haystack) {
|
||||
return contains((Object)needle, (Object[])haystack);
|
||||
}
|
||||
|
||||
void use(String s) {
|
||||
if (contains(s, getList().toArray(new String[0]))) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
native List<String> getList();
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// "Call 'toArray(new String[0])'" "true"
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
class Test {
|
||||
static <T> boolean contains(T needle, T... haystack) {
|
||||
for (final T t : haystack) {
|
||||
if (Objects.equals(t, needle)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static <T> boolean contains(String needle, String... haystack) {
|
||||
return contains((Object)needle, (Object[])haystack);
|
||||
}
|
||||
|
||||
void use(String s) {
|
||||
if (contains(s, <caret>getList())) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
native List<String> getList();
|
||||
}
|
||||
Reference in New Issue
Block a user