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

org.unlaxer.util.MultipleParamterStringPredicators Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.unlaxer.util;

import java.util.function.BiPredicate;

public class MultipleParamterStringPredicators {

  public static boolean match(BiPredicate stringPredicator, String base, String... targetClause) {
    for (String target : targetClause) {
      if (stringPredicator.test(base, target)) {
        return true;
      }
    }
    return false;
  }

  public static boolean contains(String base, String... targetClause) {
    
    return match(
        (_base,_target)->_base.contains(_target) , 
        base , 
        targetClause
    );
  }
  
  public static boolean startsWith(String base, String... targetClause) {
    
    return match(
        (_base,_target)->_base.startsWith(_target) , 
        base , 
        targetClause
    );
  }
  
  public static boolean endsWith(String base, String... targetClause) {
    
    return match(
        (_base,_target)->_base.endsWith(_target) , 
        base , 
        targetClause
    );
  }
  
  public static boolean in(String base, String... targetClause) {
    
    return match(
        (_base,_target)->_base.equals(_target) , 
        base , 
        targetClause
    );
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy