Package org.codehaus.groovy.runtime

# Class BooleanClosureForMapPredicate<K,V>

java.lang.Object
org.codehaus.groovy.runtime.BooleanClosureForMapPredicate<K,V>

All Implemented Interfaces:
  `Predicate<Map.Entry<K,V>>`

public class BooleanClosureForMapPredicate<K,V> extends Object implements Predicate<Map.Entry<K,V>>
Adapts a `Closure` to a `Predicate` over `Map.Entry` values. If the closure takes two parameters, the key and value are passed separately; otherwise the `Map.Entry` itself is passed.

Since:
  6.0.0

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `test(Map.Entry<K,V> entry)`
  Tests the given map entry 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

  - ### BooleanClosureForMapPredicate

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

- ## Method Details

  - ### test

    public boolean test(Map.Entry<K,V> entry)
    Tests the given map entry using the wrapped closure with Groovy truth conversion. If the closure takes two parameters, key and value are passed separately; otherwise the entry itself is passed.
    Specified by:
      `test` in interface `Predicate<K>`
    Parameters:
      `entry` - the `Map.Entry` to test
    Returns:
      `true` if the closure result is truthy by Groovy standards, `false` otherwise