mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-18 20:50:45 +07:00
93e35b7334
1. Fixed modifiers for interfaces
2. Replacement wrapped with Collections.unmodifiableSet
3. Supported Java 1.4 and lower
4. Supported Guava ImmutableSet
5. Supported comparisons like s.equals("xyz"), Objects.equals(s, "xyz")
16 lines
425 B
Java
16 lines
425 B
Java
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
// "Extract Set from comparison chain" "true"
|
|
public class Test {
|
|
private static final Set<String> NAMES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("foo", "bar", "baz")));
|
|
|
|
void testOr(String name) {
|
|
if(name == null || NAMES.contains(name)) {
|
|
System.out.println("foobarbaz");
|
|
}
|
|
}
|
|
}
|