This commit is contained in:
Anzori (Nika) Ghurtchumelia 2023-04-04 21:08:42 -05:00 committed by GitHub
commit 679aa84f17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,10 +4,7 @@ case class UserAge(ageInYears: Option[Int]) {
def hasAge: Boolean = ageInYears.isDefined
def isGte(ageToCompare: Int): Boolean =
ageInYears
.collectFirst {
case age if age > ageToCompare => true
}.getOrElse(false)
ageInYears.exists(_ > ageToCompare)
def unapply(userAge: UserAge): Option[Int] = {
ageInYears