Class HashedSequenceComparator<S extends Sequence>

  • Type Parameters:
    S - the base sequence type.

    public final class HashedSequenceComparator<S extends Sequence>
    extends SequenceComparator<HashedSequence<S>>
    Wrap another comparator for use with HashedSequence.

    This comparator acts as a proxy for the real comparator, evaluating the cached hash code before testing the underlying comparator's equality. Comparators of this type must be used with a HashedSequence.

    To construct an instance of this type use HashedSequencePair.

    • Method Detail

      • equals

        public boolean equals​(HashedSequence<S> a,
                              int ai,
                              HashedSequence<S> b,
                              int bi)
        Description copied from class: SequenceComparator
        Compare two items to determine if they are equivalent. It is permissible to compare sequence a with itself (by passing a again in position b).
        Specified by:
        equals in class SequenceComparator<HashedSequence<S extends Sequence>>
        Parameters:
        a - the first sequence.
        ai - item of ai to compare.
        b - the second sequence.
        bi - item of bi to compare.
        Returns:
        true if the two items are identical according to this function's equivalence rule.