Sort Key

noun

say it: “sort KEE” /sɔːrt kiː/

The thing a list is sorted by, such as a song's play count, its artist or its title; with two keys, the second only decides ties in the first.

What is a sort key?

A sort key is the thing you sort by: a song's plays, its artist, a player's points. Sorting by more than one key compares the first key, and only when it ties, the next: by artist, then by title. You hand the key, or a comparison of two items, to your language's built-in sort.

In a sentence

  • “With artist as the first sort key and title as the second, each artist's songs come out in A-to-Z order.”
  • “The playlist uses the play count as its sort key, highest first.”

Level: Apprentice · More Data Structures terms at this level

Updated