Skip to content

Instantly share code, notes, and snippets.

@smallufo
Created December 31, 2017 17:11
Show Gist options
  • Save smallufo/29ae0e441de8fbe904507cbea786f1cb to your computer and use it in GitHub Desktop.
Save smallufo/29ae0e441de8fbe904507cbea786f1cb to your computer and use it in GitHub Desktop.
interface IBookService {
fun findBooks(user: User, from: LocalDate, to: LocalDate): List<Tuple2<LocalDate, Book>>
fun findUserBooks(users: List<User>, from: LocalDate, to: LocalDate): List<Tuple3<LocalDate, User, Book>> {
return users.flatMap { user ->
findBooks(user , from , to).map { it -> Tuple3(it.v1 , user , it.v2) }
}.sortedBy { triple -> triple.v1 }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment