mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-01 04:20:56 +07:00
14 lines
416 B
Java
14 lines
416 B
Java
// "Collapse loop with stream 'findFirst()'" "true-preview"
|
|
|
|
import java.util.List;
|
|
|
|
class Scratch {
|
|
public void setStatus(List<MutablePair> destinations, String destination, Integer status) {
|
|
destinations.stream().filter(pair -> pair.first.compareTo(destination) == 0).findFirst().ifPresent(pair -> pair.second = status);
|
|
}
|
|
|
|
private static class MutablePair {
|
|
String first;
|
|
Integer second;
|
|
}
|
|
} |