io.github.avegera.stream.utils.Streams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stream-utils Show documentation
Show all versions of stream-utils Show documentation
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