org.feijoas.mango.common.base

Predicates

Related Doc: package base

object Predicates

Utility functions for the work with Guava Predicate[T]

Usage example for conversion between Guava and Mango:

// convert a Guava Predicate[T] to a Scala function T => Boolean
import com.google.common.base.{ Predicate => GuavaPredicate }
val pred: GuavaPredicate[Any] = { (arg: Any) => true }.asJava

// convert a Scala function T => Boolean to a Guava Predicate[T]
import com.google.common.base.{ Predicates => GuavaPredicates }
val pred: Any => Boolean = GuavaPredicates.alwaysTrue().asScala
Since

0.7

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Predicates
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. object alwaysFalse extends (Any) ⇒ Boolean with Product with Serializable

    Returns a predicate that always evaluates to false.

  5. object alwaysTrue extends (Any) ⇒ Boolean with Product with Serializable

    Returns a predicate that always evaluates to true.

  6. def and[T](fst: (T) ⇒ Boolean, rest: (T) ⇒ Boolean*): (T) ⇒ Boolean

    Returns a predicate that evaluates to true if each of its components evaluates to true.

    Returns a predicate that evaluates to true if each of its components evaluates to true. The components are evaluated in order, and evaluation will be "short-circuited" as soon as a false predicate is found. It defensively copies the array passed in, so future changes to it won't alter the behavior of this predicate. If components is empty, the returned predicate will always evaluate to true.

  7. def and[T](predicates: Seq[(T) ⇒ Boolean]): (T) ⇒ Boolean

    Returns a predicate that evaluates to true if each of its components evaluates to true.

    Returns a predicate that evaluates to true if each of its components evaluates to true. The components are evaluated in order, and evaluation will be "short-circuited" as soon as a false predicate is found. It defensively copies the array passed in, so future changes to it won't alter the behavior of this predicate. If components is empty, the returned predicate will always evaluate to true.

  8. implicit def asGuavaPredicateConverter[T](pred: (T) ⇒ Boolean): AsJava[Predicate[T]]

    Adds an asJava method that wraps a Scala function T => Boolean in a Guava Predicate[T].

    Adds an asJava method that wraps a Scala function T => Boolean in a Guava Predicate[T].

    The returned Guava Predicate[T] forwards all calls of the apply method to the given Scala function T => Boolean.

    pred

    the Scala function T => Boolean to wrap in a Guava Predicate[T]

    returns

    An object with an asJava method that returns a Guava Predicate[T] view of the argument

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. implicit def asMangoPredicateConverter[T](pred: Predicate[T]): AsScala[(T) ⇒ Boolean]

    Adds an asScala method that wraps a Guava Predicate[T] in a Scala function T => Boolean.

    Adds an asScala method that wraps a Guava Predicate[T] in a Scala function T => Boolean.

    The returned Scala function T => Boolean forwards all calls of the apply method to the given Guava Predicate[T].

    pred

    the Guava Predicate[T] to wrap in a Scala function T => Boolean

    returns

    An object with an asScala method that returns a Scala function T => Boolean view of the argument

  11. def assignableFrom(clazz: Class[_]): (Class[_]) ⇒ Boolean

    Returns a predicate that evaluates to true if the class being tested is assignable from the given class.

    Returns a predicate that evaluates to true if the class being tested is assignable from the given class. The returned predicate does not allow null inputs.

  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def containsPattern(pattern: Pattern): (String) ⇒ Boolean

    Returns a predicate that evaluates to true if the CharSequence being tested contains any match for the given regular expression pattern.

    Returns a predicate that evaluates to true if the CharSequence being tested contains any match for the given regular expression pattern. The test used is equivalent to pattern.matcher(arg).find()

  14. def containsPattern(pattern: String): (String) ⇒ Boolean

    Returns a predicate that evaluates to true if the String being tested contains any match for the given regular expression pattern.

    Returns a predicate that evaluates to true if the String being tested contains any match for the given regular expression pattern. The test used is equivalent to Pattern.compile(pattern).matcher(arg).find()

    Exceptions thrown

    java.util.regex.PatternSyntaxException if the pattern is invalid

  15. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. def equalTo[T](target: T): (T) ⇒ Boolean

    Returns a predicate that evaluates to true if the object being tested equals() the given target or both are null.

    Returns a predicate that evaluates to true if the object being tested equals() the given target or both are null.

  17. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  21. def in[T](coll: Seq[T]): (T) ⇒ Boolean

    Returns a predicate that evaluates to true if the object reference being tested is a member of the given collection.

    Returns a predicate that evaluates to true if the object reference being tested is a member of the given collection. It does not defensively copy the collection passed in, so future changes to it will alter the behavior of the predicate.

    The test used is equivalent to coll.contains(arg)

  22. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  23. object isNull extends (Any) ⇒ Boolean with Product with Serializable

    Returns a predicate that evaluates to true if the object reference being tested is null.

  24. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  25. def not[T](predicate: (T) ⇒ Boolean): (T) ⇒ Boolean

    Returns a predicate that evaluates to true if the given predicate evaluates to false.

    Returns a predicate that evaluates to true if the given predicate evaluates to false.

  26. object notNull extends (Any) ⇒ Boolean with Product with Serializable

    Returns a predicate that evaluates to true if the object reference being tested is not null.

  27. final def notify(): Unit

    Definition Classes
    AnyRef
  28. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  29. def or[T](fst: (T) ⇒ Boolean, rest: (T) ⇒ Boolean*): (T) ⇒ Boolean

    Returns a predicate that evaluates to true if any one of its components evaluates to true.

    Returns a predicate that evaluates to true if any one of its components evaluates to true. The components are evaluated in order, and evaluation will be "short-circuited" as soon as a true predicate is found. It defensively copies the iterable passed in, so future changes to it won't alter the behavior of this predicate. If components is empty, the returned predicate will always evaluate to false.

  30. def or[T](predicates: Seq[(T) ⇒ Boolean]): (T) ⇒ Boolean

    Returns a predicate that evaluates to true if any one of its components evaluates to true.

    Returns a predicate that evaluates to true if any one of its components evaluates to true. The components are evaluated in order, and evaluation will be "short-circuited" as soon as a true predicate is found. It defensively copies the iterable passed in, so future changes to it won't alter the behavior of this predicate. If components is empty, the returned predicate will always evaluate to false.

  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  32. def toString(): String

    Definition Classes
    AnyRef → Any
  33. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def xor[T](fst: (T) ⇒ Boolean, rest: (T) ⇒ Boolean*): (T) ⇒ Boolean

    Returns a predicate that evaluates to (((x1 xor x2) xor x3) xor x4)...

    Returns a predicate that evaluates to (((x1 xor x2) xor x3) xor x4)... for all elements xi in the sequence. It defensively copies the iterable passed in, so future changes to it won't alter the behavior of this predicate. If components is empty, the returned predicate will always evaluate to false.

  37. def xor[T](predicates: Seq[(T) ⇒ Boolean]): (T) ⇒ Boolean

    Returns a predicate that evaluates to (((x1 xor x2) xor x3) xor x4)...

    Returns a predicate that evaluates to (((x1 xor x2) xor x3) xor x4)... for all elements xi in the sequence. It defensively copies the iterable passed in, so future changes to it won't alter the behavior of this predicate. If components is empty, the returned predicate will always evaluate to false.

Inherited from AnyRef

Inherited from Any

Ungrouped