mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-19 10:20:56 +07:00
27 lines
611 B
Java
27 lines
611 B
Java
// "Replace Stream API chain with loop" "true-preview"
|
|
|
|
import java.util.Arrays;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
public class Main {
|
|
private static long test() {
|
|
long count = 0L;
|
|
Set<Integer> uniqueValues = new HashSet<>();
|
|
boolean first = true;
|
|
for (Integer i : new Integer[]{1, 2, 3, 2, 3}) {
|
|
if (first) {
|
|
first = false;
|
|
continue;
|
|
}
|
|
if (uniqueValues.add(i)) {
|
|
count++;
|
|
}
|
|
}
|
|
return count;
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(test());
|
|
}
|
|
} |