On Feb 12, 2015, at 8:29 PM, Louis Wasserman <lowas...@google.com> wrote:
> I'm not sure I can share hard numbers, but the ratio of > > if (optional.isPresent()) { > // non-returning statements here > } > > to > > if (optional.isPresent()) { // or negated > // non-returning statements here > } else { > // non-returning statements here > } > > is ~5.5x in favor of the no-else case. Both patterns have large numbers of > hits, though, so I'm satisfied that this is not an unreasonable thing to do. Many thanks, that's good to know. > > I can possibly try to extract statistics on how many of these cases would be > easily converted to method references and other things that might be easier > to express with functional interfaces, but I'm not sure how necessary that > actually is. > It might be interesting, but i would be more curious about the following case: if (!optional.isPresent()) { ... } // no else would it be possible to get some numbers on that? Thanks, Paul.