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

Wesllhey Holanda edited comment on COLLECTIONS-742 at 12/20/19 1:42 PM:
------------------------------------------------------------------------

Hello, Chen Guopin,

The "problem" of it, is when the collection is null, it will return an 
exception, and not null.

I think that with a method that return null when the collection is null, it 
will avoid to deal with null point exception before the method call. 


was (Author: wesllhey):
The "problem" of it, is when the collection is null, it will return an 
exception, and not null.

I think that with a method that return null when the collection is null, it 
will avoid to deal with null point exception before the method call. 

> Create new method in CollectionUtils to return first element if not null
> ------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-742
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-742
>             Project: Commons Collections
>          Issue Type: New Feature
>          Components: Collection
>    Affects Versions: 4.4
>            Reporter: Wesllhey Holanda
>            Priority: Minor
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> When we try to get the first element into collection, we have to lead with 
> null point exception. So with this method, when the collection is null or 
> empty, the method will return null, and when not, the method will return the 
> first element.
> In this way, the user don't need to write nothing to lead with null point 
> exception.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to