mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-18 08:50:57 +07:00
PR#2100 Co-authored-by: Tagir Valeev <tagir.valeev@jetbrains.com> GitOrigin-RevId: c0b8495f26bccf51c593deb6be927eb01c37d379
21 lines
578 B
Java
21 lines
578 B
Java
// "Replace Optional presence condition with functional style expression" "true-preview"
|
|
import java.util.Optional;
|
|
|
|
class Trip implements Comparable<Trip> {
|
|
Optional<Integer> originId;
|
|
|
|
public Trip(Optional<Integer> originId) {
|
|
this.originId = originId;
|
|
}
|
|
|
|
public Optional<Integer> getOriginId() {
|
|
return originId;
|
|
}
|
|
|
|
@Override
|
|
public int compareTo(Trip o) {
|
|
return this.originId.isPresent() ?
|
|
(o.originId.is<caret>Present() ? Integer.compare(this.originId.get(), o.originId.get()) : -1) :
|
|
(o.originId.isPresent() ? 1 : 0);
|
|
}
|
|
} |