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

io.github.avegera.stream.utils.Matchers 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.function.Predicate;

import static io.github.avegera.stream.utils.Streams.safeStream;

/**
 * The class contains laconic method-aliases for safely performing search operations in Java-collections.
 * The result of the class methods execution is a boolean value.
 */
public class Matchers {

    private Matchers() {
        //empty private constructor
    }

    public static  boolean allMatch(Collection collection, Predicate predicate) {
        return safeStream(collection)
                .allMatch(predicate);
    }

    public static  boolean anyMatch(Collection collection, Predicate predicate) {
        return safeStream(collection)
                .anyMatch(predicate);
    }

    public static  boolean noneMatch(Collection collection, Predicate predicate) {
        return safeStream(collection)
                .noneMatch(predicate);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy