Interface NodeEqualityPredicate

  • 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 NodeEqualityPredicate
    An equality test for determining if two nodes are to be considered equal.

    Recall that Nodes have 4 key attributes: key, value, context, expiry.

    In the default Node.equals(Object) implementation (equivalent to EXACT), all 4 of these key attributes are considered. However, there are occasions where such strict equality checking is not desired, hence the use of this class.

    NodeEqualityPredicates can either be used inline, by directly calling the areEqual(Node, Node) method, or can be passed as a parameter to the Node.equals(Node, NodeEqualityPredicate) method. Either approach is valid, and both will result in the same result.

    Generally, implementations of this interface should fulfil the same requirements as the Object.equals(Object) contract.

    • Field Detail

      • IGNORE_EXPIRY_TIME

        static final NodeEqualityPredicate IGNORE_EXPIRY_TIME
        All attributes must match, except for the expiry time, which is ignored.

        Note that with this setting, whether a node has an expiry or not is still considered.

        Returns true if: (and)

      • IGNORE_EXPIRY_TIME_AND_VALUE

        static final NodeEqualityPredicate IGNORE_EXPIRY_TIME_AND_VALUE
        All attributes must match, except for value and the expiry time, which are ignored.

        Note that with this setting, whether a node has an expiry or not is still considered.

        Returns true if: (and)

      • IGNORE_VALUE_OR_IF_TEMPORARY

        static final NodeEqualityPredicate IGNORE_VALUE_OR_IF_TEMPORARY
        All attributes must match, except for value and the if the node has an expiry, which are ignored.

        Effectively only considers the key and the context.

        Returns true if: (and)