Class HashedSequence<S extends Sequence>

  • Type Parameters:
    S - the base sequence type.

    public final class HashedSequence<S extends Sequence>
    extends Sequence
    Wraps a Sequence to assign hash codes to elements.

    This sequence acts as a proxy for the real sequence, caching element hash codes so they don't need to be recomputed each time. Sequences of this type must be used with a HashedSequenceComparator.

    To construct an instance of this type use HashedSequencePair.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) S base  
      (package private) int[] hashes  
    • Constructor Summary

      Constructors 
      Constructor Description
      HashedSequence​(S base, int[] hashes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int size()
      Get size
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • hashes

        final int[] hashes
    • Constructor Detail

      • HashedSequence

        HashedSequence​(S base,
                       int[] hashes)
    • Method Detail

      • size

        public int size()
        Get size
        Specified by:
        size in class Sequence
        Returns:
        size