All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.smallrye.mutiny.converters.uni.ToSingleFailOnNull Maven / Gradle / Ivy

There is a newer version: 1.10.0
Show newest version
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