Created
October 31, 2019 09:21
-
-
Save adamw/1a1df65ee2c1b973b14e9331426f8911 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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