On Feb 12, 2015, at 10:16 PM, Louis Wasserman lowas...@google.com 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.
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's
On Feb 12, 2015, at 7:27 PM, Louis Wasserman lowas...@google.com 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,
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 daniel.fu...@oracle.com wrote:
Hi Paul,
This looks good - I have noticed one copy/paste error in the javadoc
though:
OptionalInt.java:
looks like the throws clause
On Feb 12, 2015, at 7:00 PM, Louis Wasserman lowas...@google.com 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
On Feb 12, 2015, at 3:50 PM, Daniel Fuchs daniel.fu...@oracle.com 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
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
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,
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.
*
*
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
On Feb 3, 2015, at 4:47 PM, Stephen Colebourne scolebou...@joda.org 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
11 matches
Mail list logo