Created
March 11, 2023 03:36
-
-
Save hiramekun/cc4cd35488a3198566858060d0506c48 to your computer and use it in GitHub Desktop.
CollectFirstSome
This file contains 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
private def collectFirstSome[A, B](seq: Seq[A])(fn: A => Option[B]): Option[B] = { | |
seq.collectFirst(Function.unlift(fn)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment