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

io.github.avegera.stream.utils.Streams Maven / Gradle / Ivy

Go to download

The library of laconic method-aliases for the safety Stream API operations on Java-collections

The newest version!
package io.github.avegera.stream.utils;

import java.util.Collection;
import java.util.stream.Stream;

import static java.util.stream.Stream.empty;

/**
 * The class contains laconic method-aliases for safe stream operations with collections in Java.
 * The result of class methods operations is {@link java.util.stream.Stream}
 */
public class Streams {

    private Streams() {
        //empty private constructor
    }

    public static  Stream safeStream(Collection collection) {
        return collection != null && !collection.isEmpty() ? collection.stream() : empty();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy