Class StripedHashFunction<T>


  • public class StripedHashFunction<T>
    extends Object
    An hash function for stripping.

    It calculates the number of segments based on the concurrency level desired and hashes the object to the corresponding segments.

    Since:
    8.0
    Author:
    Pedro Ruivo
    • Constructor Detail

      • StripedHashFunction

        public StripedHashFunction​(int concurrencyLevel)
    • Method Detail

      • getNumSegments

        public final int getNumSegments()
        Returns:
        the number of segments.
      • hashToSegment

        public final int hashToSegment​(T object)
        It calculates the segment in which the object belongs.
        Parameters:
        object - the object to hash.
        Returns:
        the segment index, between 0 and getNumSegments()-1.