Skip to content

Instantly share code, notes, and snippets.

@adamw adamw/polynote.scala
Created Oct 31, 2019

Embed
What would you like to do?
case class LetterAndCount(letter: String, count: Int)
// result: Response[GitHubResult] is what we've read from the API
val firstLetterToName = result.items.groupBy(_.name.toUpperCase.charAt(0))
val pairs = firstLetterToName.toList.map { case (letter, projects) =>
LetterAndCount(letter.toString, projects.size)
}.sortBy(_.letter)
pairs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.