Skip to content

Instantly share code, notes, and snippets.

@Korilakkuma
Created April 25, 2016 11:24
Show Gist options
  • Save Korilakkuma/a3eba57eb333bfe84d3c614b666ba2bf to your computer and use it in GitHub Desktop.
Save Korilakkuma/a3eba57eb333bfe84d3c614b666ba2bf to your computer and use it in GitHub Desktop.
Reverse method by foldLeft
def reverse[T](list: List[T]): List[T] = list.foldLeft(Nil: List[T])((a, b) => b :: a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment