Why not using map?  


On Sunday, April 28, 2013 at 11:21 AM, Sam Zhao wrote:

> In src/main/scala/com/walmartlabs/mupd8/SourceReader.scala:
> > > - if (rlt != null) rlt > - else if (!repeat) { > - if (reader != null) {reader close; reader = null} > - null > - } else { > - readLine(repeat, repeatTimes + 1) > - } > + private def destroyReader : Unit = { > + _reader = _reader.flatMap(r => {r.close; None})  
> >  
>  
> Hm... Line 127 might just be too smart here. It's a bit subtle, but flatMap seems to be necessary to do the following:
> _reader match { case None: None case Some(x): {x.close; None} }  
>  
>  
> —
> Reply to this email directly or view it on GitHub (https://github.com/walmartlabs/mupd8/pull/20/files#r3991988).