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

com.jn.langx.util.boundary.CommonBoundary Maven / Gradle / Ivy

Go to download

Java lang extensions for java6+, a supplement to , replacement of a Guava, commons-lang. Core utilities, Collection utilities, IO utilities, Cache, Configuration library ...

There is a newer version: 4.8.2
Show newest version
package com.jn.langx.util.boundary;

import com.jn.langx.util.Preconditions;
import com.jn.langx.util.collection.Collects;
import com.jn.langx.util.function.Predicate;

import java.util.List;

public class CommonBoundary implements Boundary {
    private List> predicates = Collects.emptyArrayList();

    @Override
    public boolean test(final String value) {
        Preconditions.checkNotEmpty(predicates);

        return Collects.allMatch(predicates, new Predicate>() {
            @Override
            public boolean test(Predicate predicate) {
                return predicate.test(value);
            }
        });
    }

    public void addPredicate(Predicate predicate) {
        if (predicate != null) {
            predicates.add(predicate);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy