mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-02 03:07:47 +07:00
18 lines
387 B
Java
18 lines
387 B
Java
// "Replace Stream API chain with loop" "true"
|
|
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
|
|
public class Main {
|
|
public long test(List<String> list) {
|
|
long count = 0;
|
|
Set<String> uniqueValues = new HashSet<>();
|
|
for (String s : list) {
|
|
if (uniqueValues.add(s)) {
|
|
count++;
|
|
}
|
|
}
|
|
return count;
|
|
}
|
|
} |