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

Vadim Kirilchuk commented on SOLR-5148:
---------------------------------------

Just looked through the patch and have some hint: it's worth to return empty 
collection in case of no children docs. It will help to avoid this weird null 
checks. (Joshua Bloch writes about it in his "Effective Java" book)

http://books.google.ru/books?id=ka2VUBqHiWkC&pg=PA201&lpg=PA201&dq=joshua+bloch+return+empty+collection&source=bl&ots=yYJoIjtZR3&sig=zRFogOMltXze3fEei20ZqiOVo9A&hl=en&sa=X&ei=urkyUpyzDoqC4gSfuYCoBg&ved=0CCgQ6AEwAA#v=onepage&q=joshua%20bloch%20return%20empty%20collection&f=false

It means that internally you can still have null childrenDocuments, but null 
check should be done *only* in getters. All external code should work with non 
null collection.

What do you think?
                
> SolrInputDocument children field should be lazy
> -----------------------------------------------
>
>                 Key: SOLR-5148
>                 URL: https://issues.apache.org/jira/browse/SOLR-5148
>             Project: Solr
>          Issue Type: Sub-task
>            Reporter: Vadim Kirilchuk
>            Priority: Minor
>             Fix For: 4.5, 5.0
>
>         Attachments: SOLR-5148.patch
>
>
> Currently this field is initialized in constructor, it is better to 
> initialize it lazilly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to