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

org.umlg.runtime.adaptor.StringArrayContains Maven / Gradle / Ivy

There is a newer version: 2.0.15
Show newest version
package org.umlg.runtime.adaptor;

import java.util.Arrays;
import java.util.function.BiPredicate;

/**
 * Date: 2015/06/27
 * Time: 2:15 PM
 */
public enum StringArrayContains implements BiPredicate {

    within {
        @Override
        public boolean test(final String[] first, final Object second) {
            return Arrays.asList(first).contains(second);
        }
    }, without {
        @Override
        public boolean test(final String[] first, final Object second) {
            return !Arrays.asList(first).contains(second);
        }
    };

    /**
     * {@inheritDoc}
     */
    @Override
    public abstract boolean test(final String[] first, final Object second);

    /**
     * Produce the opposite representation of the current {@code Contains} enum.
     */
    @Override
    public StringArrayContains negate() {
        return this.equals(within) ? without : within;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy