io.smallrye.mutiny.converters.uni.ToSingleFailOnNull Maven / Gradle / Ivy
package io.smallrye.mutiny.converters.uni;
import java.util.NoSuchElementException;
import java.util.function.Function;
import io.reactivex.Single;
import io.smallrye.mutiny.Uni;
public class ToSingleFailOnNull implements Function, Single> {
public static final ToSingleFailOnNull INSTANCE = new ToSingleFailOnNull();
private ToSingleFailOnNull() {
// Avoid direct instantiation
}
@Override
public Single apply(Uni uni) {
return Single.fromPublisher(uni.onItem().ifNull().failWith(NoSuchElementException::new).convert().toPublisher());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy