mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-17 11:40:50 +07:00
19 lines
440 B
Java
19 lines
440 B
Java
import java.util.Arrays;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
// "Extract Set from comparison chain" "true"
|
|
public class Test {
|
|
private static final Set<String> NAMES = new HashSet<>(Arrays.asList("foo", "bar", "baz"));
|
|
|
|
interface Person {
|
|
String getName();
|
|
}
|
|
|
|
void testOr(Person person) {
|
|
if(NAMES.contains(person.getName()) || person.getName() == null) {
|
|
System.out.println("foobarbaz");
|
|
}
|
|
}
|
|
}
|