Last active
August 22, 2020 03:10
-
-
Save hanishi/06f25d0b3ba32c3fccd7d891eba432e1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@tailrec | |
private def criteria( | |
baseCriteria: Criteria, | |
criteriaList: Option[Criteria]* | |
): Criteria = { | |
criteriaList match { | |
case head :: tail => | |
criteria( | |
head.fold(baseCriteria) { criteria => | |
baseCriteria.copy(startDateTime = | |
criteria.startDateTime.orElse(baseCriteria.startDateTime) | |
) | |
}, | |
tail: _* | |
) | |
case Nil => baseCriteria | |
} | |
} |
Author
hanishi
commented
Aug 22, 2020
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment