You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2022/08/12 21:43:00 UTC
[jira] [Comment Edited] (LANG-1689) ObjectUtils#isEmpty and ObjectUtils#isNotEmpty should support Java8 Optional
[ https://issues.apache.org/jira/browse/LANG-1689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17579148#comment-17579148 ]
Gary D. Gregory edited comment on LANG-1689 at 8/12/22 9:42 PM:
----------------------------------------------------------------
I'm leaning no:
At first I thought this would be OK but now I'm not sure and would like community feedback:
* There are APIs in the JRE called {{isEmpty()}} on various classes that usually return true when {{{}size() == 0{}}}; for example {{{}Collection{}}}, {{{}String{}}}, and {{{}Map{}}}.
* There _isn't_ an {{Optional}} API called {{{}isEmpty(){}}}, instead, there is a different concept represented by {{{}isPresent(){}}}; which returns true when the wrapped value is non-null.
So it feels like the PR conflates the two concepts.
was (Author: garydgregory):
I'm leaning no:
At first I thought this would be OK but now I'm not sure and would like community feedback:
* There are APIs im the JRE called {{isEmpty()}} on various classes that usually return true when {{{}size() == 0{}}}; for example {{{}Collection{}}}, {{{}String{}}}, and {{{}Map{}}}.
* There _isn't_ an {{Optional}} API called {{{}isEmpty(){}}}, instead, there is a different concept represented by {{{}isPresent(){}}}; which returns true when the wrapped value is non-null.
So it feels like the PR conflates the two concepts.
> ObjectUtils#isEmpty and ObjectUtils#isNotEmpty should support Java8 Optional
> ----------------------------------------------------------------------------
>
> Key: LANG-1689
> URL: https://issues.apache.org/jira/browse/LANG-1689
> Project: Commons Lang
> Issue Type: Improvement
> Reporter: Baljit Singh
> Priority: Minor
>
> Current methods support CharSequence, Array, Collection, and Map. It should also support Optional.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)