public interface Ranking
Represents an element of a sorted set, composed of a member and its associated score.

In data stores such as Valkey, a sorted set maintains elements ordered by a numeric value (commonly referred to as a score). This interface models that concept in a domain-oriented way, abstracting the underlying storage details while preserving ordering semantics.

Design note: This type is a value object and should be treated as immutable. Implementations are expected to provide consistent equals and hashCode semantics based on both member and score.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the unique member identifier within the sorted set.
    Returns the numeric score associated with this member.
    static Ranking
    of(String member, Number points)
    Creates a new Ranking instance with the given member and score.
  • Method Details

    • getPoints

      Number getPoints()
      Returns the numeric score associated with this member.

      The score determines the ordering of elements within the sorted set.

      Returns:
      the score used for ordering; never null
    • getMember

      String getMember()
      Returns the unique member identifier within the sorted set.
      Returns:
      the member identifier; never null
    • of

      static Ranking of(String member, Number points) throws NullPointerException
      Creates a new Ranking instance with the given member and score.

      This factory method provides a consistent way to create immutable Ranking instances.

      Parameters:
      member - the member identifier; must not be null
      points - the score associated with the member; must not be null
      Returns:
      a new Ranking instance
      Throws:
      NullPointerException - if either member or points is null