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

Hoss Man commented on SOLR-107:
-------------------------------

i only briefly skimmed the patch, but a couple quick questions came to mind...

1) instead of creating a new NameValuePair<T> interface, couldn't named list 
just impliment Iterable<Map.Entry<String,T>> ?

2) for this bit of code...

@@ -183,7 +185,7 @@
     Iterator iter = eset.iterator();
     while (iter.hasNext()) {
       Map.Entry entry = (Map.Entry)iter.next();
-      add(entry.getKey().toString(), entry.getValue());
+      add(entry.getKey().toString(), (T)entry.getValue());
     }
     return args.size()>0;
   }

...that's in "addAll(Map)" right? ... if we're genericizing NamedList with 
respect to T, then shouldn't the method sig change to "addAll(Map<?,T>)" ... 
which would eliminate the need for the cast right?

3) there's an "addAll(NamedList)" too isn't there? .. shouldn't that method 
change to "addAll(NamedList<T>)" as well?


(I think all of those would still work in the current code base using the 
generics default of Object for unspecified templates)


> Iterable NamedList with java5 generics
> --------------------------------------
>
>                 Key: SOLR-107
>                 URL: https://issues.apache.org/jira/browse/SOLR-107
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Ryan McKinley
>            Priority: Trivial
>         Attachments: IterableNamedList.patch
>
>
> Iterators and generics are nice!
> this patch adds both to NamedList.java

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to