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

no.arktekk.siren.util.StreamableIterable Maven / Gradle / Ivy

package no.arktekk.siren.util;

import io.vavr.collection.List;
import io.vavr.control.Option;

import java.util.stream.Stream;

public interface StreamableIterable extends Iterable {

    default Stream stream() {
        return StreamUtils.stream(this);
    }

    default Stream parallellStream() {
        return StreamUtils.parallellStream(this);
    }

    default Option headOption() {
        return Option.ofOptional(stream().findFirst());
    }

    default boolean isEmpty() {
        return !headOption().isDefined();
    }

    default List toList() {
        return List.ofAll(this);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy