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

com.github.methylene.args.predicate.StringPredicates Maven / Gradle / Ivy

The newest version!
package com.github.methylene.args.predicate;

import com.github.methylene.args.Predicate;

import java.util.regex.Pattern;

public class StringPredicates {

  public static Predicate notEmpty() {
    return new Predicate() {
      @Override
      public boolean matches(String arg) {
        return arg != null && !arg.isEmpty();
      }
    };
  }

  public static Predicate notBlank() {
    return new Predicate() {
      @Override
      public boolean matches(String arg) {
        return arg != null && !arg.trim().isEmpty();
      }
    };
  }

  public static Predicate matches(final Pattern p) {
    return new Predicate() {
      @Override
      public boolean matches(String arg) {
        return p.matcher(arg).matches();
      }
    };
  }


}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy