Skip to content

Instantly share code, notes, and snippets.

@katzkb
Created April 5, 2022 04:17
Show Gist options
  • Save katzkb/77f8bc4e95bb7d67bac94a36bfee4839 to your computer and use it in GitHub Desktop.
Save katzkb/77f8bc4e95bb7d67bac94a36bfee4839 to your computer and use it in GitHub Desktop.
val startTime = System.currentTimeMillis
val groupMap: Map[UserId, Seq[Group]] =
groupMemberSeq.groupBy(_.userId) map { case (userId, members) =>
(
userId,
members.flatMap(member =>
groupSeq.find(_.id == member.groupId)
)
)
}
val result: Seq[UserView] = userSeq.map(user =>
UserView(
user.id,
user.name,
groupMap(user.id)
)
)
println((System.currentTimeMillis - startTime).toString + "ミリ秒")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment