mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-22 06:20:54 +07:00
36 lines
909 B
Java
36 lines
909 B
Java
// "Extract Set from comparison chain|->Replace all occurrences" "true-preview"
|
|
|
|
import java.util.Collections;
|
|
import java.util.EnumSet;
|
|
import java.util.Set;
|
|
|
|
public class Test {
|
|
private static final Set<Status> STATUSES = Collections.unmodifiableSet(EnumSet.of(Status.VALID, Status.PENDING));
|
|
|
|
enum Status {
|
|
VALID, PENDING, INVALID, UNKNOWN;
|
|
}
|
|
|
|
void test1(Status status) {
|
|
if(STATUSES.contains(status)) {
|
|
System.out.println("ok");
|
|
}
|
|
}
|
|
|
|
static class Another {
|
|
static final String STATUSES = "";
|
|
|
|
void test2(Status st) {
|
|
if(st == null || Test.STATUSES.contains(st) || Math.random() > 0.5) {
|
|
System.out.println("Replace here as well");
|
|
}
|
|
}
|
|
|
|
void test3(Status st2) {
|
|
if(st2 == Status.VALID || st2 == Status.PENDING || st2 == Status.UNKNOWN) {
|
|
System.out.println("Do not replace as we test three statuses");
|
|
}
|
|
}
|
|
}
|
|
}
|