bool operator ==(
Object other
)

Test whether another object is equal to this function.

System-created function objects are only equal to other functions.

Two function objects are known to represent the same function if

  • It is the same object. Static and top-level functions are compile time constants when used as values, so referring to the same function twice always give the same object,

  • or if they refer to the same member method extracted from the same object. Extracting a member method as a function value twice gives equal, but not necessarily identical, function values.

Function expressions never give rise to equal function objects. Each time a function expression is evaluated, it creates a new closure value that is not known to be equal to other closures created by the same expression.

Classes implementing Function by having a call method should have their own operator== and hashCode depending on the object.

Source

/**
 * Test whether another object is equal to this function.
 *
 * System-created function objects are only equal to other functions.
 *
 * Two function objects are known to represent the same function if
 *
 * - It is the same object. Static and top-level functions are compile time
 *   constants when used as values, so referring to the same function twice
 *   always give the same object,
 * - or if they refer to the same member method extracted from the same object.
 *   Extracting a member method as a function value twice gives equal, but
 *   not necessarily identical, function values.
 *
 * Function expressions never give rise to equal function objects. Each time
 * a function expression is evaluated, it creates a new closure value that
 * is not known to be equal to other closures created by the same expression.
 *
 * Classes implementing `Function` by having a `call` method should have their
 * own `operator==` and `hashCode` depending on the object.
 */
bool operator==(Object other);