Interface Relation<S,O>

Type Parameters:
S - the type of the subject of the relation
O - the type of the object of the relation
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Relation<S,O>
Defines a relationship between two objects. For example, if x is a Map and y is a String appearing as a key in that Map, then the contains-key relation exists between x and y. See the package description for more information.
Author:
Ayco Holleman
  • Method Summary

    Modifier and Type
    Method
    Description
    default Relation<O,S>
    Returns the converse of this relation, swapping subject and object in the relationship.
    boolean
    exists(S subject, O object)
    Determines whether the two arguments have the relation that the implementation attempts to establish.
    default Relation<S,O>
    Returns the negation of this Relation.
  • Method Details

    • converse

      default Relation<O,S> converse()
      Returns the converse of this relation, swapping subject and object in the relationship. For example, the converse of x contains y is y contains x (or x is-element-of y).
      Returns:
      the converse of this Relation
    • negate

      default Relation<S,O> negate()
      Returns the negation of this Relation.
      Returns:
      the negation of this Relation
    • exists

      boolean exists(S subject, O object)
      Determines whether the two arguments have the relation that the implementation attempts to establish.
      Parameters:
      subject - The value to test
      object - The value to test it against
      Returns:
      true if the relation exists, false otherwise.