[ 
https://issues.apache.org/jira/browse/WICKET-6396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16052996#comment-16052996
 ] 

Kamil commented on WICKET-6396:
-------------------------------

[~mgrigorov] If theese are just "useful but I can also live without them", what 
was the reasoning for adding
{code}
map, filter, orElse and orElseGet
{code}
? You can also live without them (using bunch of ugly null checks).
It the reasoning was "let's get rid of theese ugly null checks" then my 
proposal is valid.

[~emond], of course Optionals can "hold null". This is why Optional.ofNullable 
is for...
Yes, Models are different than Optionals in a way, that they are mutable, but 
other than that I'd say that they are very simmilar! 
And mutability causes even bigger need of having convenient methods to operate 
on underlying object (because It can change any time, and once can be null and 
another time not. Being able to call ifPresent right away would be a blessing)

> Model should provide other Optional's methods
> ---------------------------------------------
>
>                 Key: WICKET-6396
>                 URL: https://issues.apache.org/jira/browse/WICKET-6396
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 8.0.0-M6
>            Reporter: Kamil
>            Priority: Minor
>
> Model should provide
> {code}
> public <X extends Throwable> T orElseThrow(Supplier<? extends X> 
> exceptionSupplier) throws X;
> {code}
> {code}
> public boolean isPresent();
> {code}
> {code}
> public void ifPresent(Consumer<? super T> consumer);
> {code}
> methods for the sake of consistency with Optional API



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to