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

Noble Paul commented on SOLR-912:
---------------------------------

bq.The interface is present only to enable the migration from NamedList 
(legacy) to the new one. (with similar properties of Cloneable, Serializable 
etc. ).
This means we will need to use this interface wherever we use NamedList which 
is not desirable

NamedList is designed to achieve a specific purpose 

Solr is not meant for java users only. It is also meant to be consumed over 
xml/json etc .There is no type safety in these. NamedList helps us to have a 
datastructure which can easily be converted back and forth from these. 

bq.If type-safety is not a concern - is there a reason why NamedList<T> is 
defined as a generic type
It helps where it makes sense . But where it is not necessary I can totally 
omit that and javac does not complain. So , it is better to keep it generic 
than not. 

bq.There seems to be no memory leaks as far as the container is concerned

There are no leaks. I was referring to the internal implementation . instead of 
one big array you keep a list of objects (means more objects, one per entry) .  

bq.Creating an iterator object for every call to an iterator 

iterating over NamedList does not need to use an iterator. That is a choice 
left to the consumer of the API

> org.apache.solr.common.util.NamedList - Typesafe efficient variant - 
> ModernNamedList introduced - implementing the same API as NamedList
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-912
>                 URL: https://issues.apache.org/jira/browse/SOLR-912
>             Project: Solr
>          Issue Type: Improvement
>          Components: clients - java
>    Affects Versions: 1.4
>         Environment: Tomcat 6, JRE 6, Solr 1.3+ nightlies 
>            Reporter: Kay Kay
>            Priority: Minor
>             Fix For: 1.3.1
>
>         Attachments: SOLR-912.patch
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> The implementation of NamedList - while being fast - is not necessarily 
> type-safe. I have implemented an additional implementation of the same - 
> ModernNamedList (a type-safe variation providing the same interface as 
> NamedList) - while preserving the semantics in terms of ordering of elements 
> and allowing null elements for key and values (keys are always Strings , 
> while values correspond to generics ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to