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

org.defendev.common.stream.Streams Maven / Gradle / Ivy

Go to download

Common utils purely based on JDK and no other dependencies. Only exception being for org.jetbrains:annotations for building stratgic Kotlin language compatibility.Another only-exception is Apache Commons Lang3.

The newest version!
package org.defendev.common.stream;

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

import static java.util.Objects.isNull;



public class Streams {

    public static  Stream stream(Collection collection) {
        return isNull(collection) ?
            Stream.empty()
            : collection.stream();
    }

    public static  Stream stream(Enumeration enumeration) {
        return isNull(enumeration) ?
            Stream.empty()
            : Collections.list(enumeration).stream();
    }

    /* TODO: possibly consider variant with Iterable  */

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy