Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADAM-582] Eliminate .get on option in FragmentCoverter.
Resolves #582. In the FragmentConverter, we had code that called .get on an optional ReferenceRegion. If a NucleotideContigFragment didn't have a contig associated with it, then we would call .get on the empty option, which would throw an error. This commit changes that code to call map on the Option[ReferenceRegion], and then changes the usage of that method so that it is called in a flatMap. Additionally, I've added a test to cover this case.
- Loading branch information
7c2df60
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. This is pretty cool. I was thinking about exception handling, instead I needed to think FP style and go back to Option and sort it out without a failure. Sorry I didn't think that way sooner. I tend to use Optional in Java 8 freely but didn't see it here.