Package org.codehaus.groovy.runtime

# Class BooleanClosurePredicate<T>

java.lang.Object
org.codehaus.groovy.runtime.BooleanClosurePredicate<T>

All Implemented Interfaces:
  `Predicate<T>`

public class BooleanClosurePredicate<T> extends Object implements Predicate<T>
Adapts a `Closure` to a `Predicate`, converting the closure's return value to a boolean using Groovy truth semantics.

Since:
  6.0.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BooleanClosurePredicate(Closure wrapped)`
  Constructs a BooleanClosurePredicate from a Closure.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `test(T arg)`
  Tests the given value using the wrapped closure with Groovy truth conversion.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.util.function.Predicate

  `and, negate, or`

- ## Constructor Details

  - ### BooleanClosurePredicate

    public BooleanClosurePredicate(Closure wrapped)
    Constructs a BooleanClosurePredicate from a Closure.
    Parameters:
      `wrapped` - the `Closure` to adapt to a predicate

- ## Method Details

  - ### test

    public boolean test(T arg)
    Tests the given value using the wrapped closure with Groovy truth conversion.
    Specified by:
      `test` in interface `Predicate<T>`
    Parameters:
      `arg` - the value to test
    Returns:
      `true` if the closure result is truthy by Groovy standards, `false` otherwise