On Feb 12, 2015, at 10:16 PM, Louis Wasserman wrote:
> Sure. The "if present":"if present else":"if absent" ratio is ~24:6:1.
>
Thanks! Given those rations i think we are good with just one extra method. I
have added you as a reviewer.
Paul.
On Feb 12, 2015, at 8:29 PM, Louis Wasserman 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 {
> //
The new version looks good Paul!
-- daniel
On 2/12/15 6:50 PM, Paul Sandoz wrote:
On Feb 12, 2015, at 3:50 PM, Daniel Fuchs wrote:
Hi Paul,
This looks good - I have noticed one copy/paste error in the javadoc
though:
OptionalInt.java:
looks like the throws clause of ifPresent and ifPresen
On Feb 12, 2015, at 7:27 PM, Louis Wasserman wrote:
> I get that ifPresent is already available; I'm curious if you examined how
> often there is actually an "if absent" case in practice, relative to the
> "only do something if present" case.
>
> If you don't have statistics,
No, since this is
I get that ifPresent is already available; I'm curious if you examined how
often there is actually an "if absent" case in practice, relative to the
"only do something if present" case.
If you don't have statistics, I could fairly easily get statistics on
Google's codebase for what usages of Guava'
On Feb 12, 2015, at 7:00 PM, Louis Wasserman wrote:
> How often does the case when you "have a lambda handy already" come up in
> practice? If this leads to people using this method instead of ifPresent,
> that seems wasteful.
>
A lambda bearing ifPresent is already "present" (sorry!) :-) t
On Feb 12, 2015, at 3:50 PM, Daniel Fuchs wrote:
> Hi Paul,
>
> This looks good - I have noticed one copy/paste error in the javadoc
> though:
>
> OptionalInt.java:
>
> looks like the throws clause of ifPresent and ifPresentOrElse have been
> interverted:
>
> 138 * @throws NullPointerEx
Hi Paul,
This looks good - I have noticed one copy/paste error in the javadoc
though:
OptionalInt.java:
looks like the throws clause of ifPresent and ifPresentOrElse have been
interverted:
138 * @throws NullPointerException if a value is present and
{@code action} is
139 * null, o
On Feb 3, 2015, at 4:47 PM, Stephen Colebourne wrote:
> Can't say I've used isPresent() much, as map()/flatMap()/orElse() take
> care of most use cases.
>
Yes, i suspect terminal action-based processing is less used than value
transformation.
> What is an issue is that the primitive optional
Can't say I've used isPresent() much, as map()/flatMap()/orElse() take
care of most use cases.
What is an issue is that the primitive optional classes do not have
ofNullable(), filter(), map() or flatMap(). It seems odd to be adding
an additional new method to the primitive optional classes withou
Hi,
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8071670-Optional-ifPresentOrElse/webrev/
Here is another tweak to Optional (and primitives) that has some weight:
/**
* If a value is present, perform the given action with the value,
* otherwise perform the given empty-based action.
*
* @para
11 matches
Mail list logo