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

com.github.tonivade.purefun.CheckedMatcher Maven / Gradle / Ivy

/*
 * Copyright (c) 2018-2019, Antonio Gabriel Muñoz Conejo 
 * Distributed under the terms of the MIT License
 */
package com.github.tonivade.purefun;

@FunctionalInterface
public interface CheckedMatcher {

  boolean match(A target) throws Throwable;

  default CheckedMatcher and(CheckedMatcher other) {
    return request -> match(request) && other.match(request);
  }

  default CheckedMatcher or(CheckedMatcher other) {
    return request -> match(request) || other.match(request);
  }

  default CheckedMatcher negate() {
    return request -> !match(request);
  }

  static  CheckedMatcher not(CheckedMatcher matcher) {
    return matcher.negate();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy