package it.cavallium.dbengine.client; import java.util.Comparator; import java.util.function.Function; import org.jetbrains.annotations.NotNull; import reactor.core.publisher.Mono; public record HitKey(T key, float score) implements Comparable> { public Mono> withValue(Function> valueGetter) { return valueGetter.apply(key).map(value -> new HitEntry<>(key, value, score)); } @Override public int compareTo(@NotNull HitKey o) { return Float.compare(o.score, this.score); } }