mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-18 08:50:57 +07:00
20 lines
507 B
Java
20 lines
507 B
Java
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
// "Extract Set from comparison chain" "true-preview"
|
|
public class Test {
|
|
private static final Set<String> NAMES = Collections.unmodifiableSet(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");
|
|
}
|
|
}
|
|
}
|