On Fri, Jan 7, 2011 at 10:47 PM,  <[email protected]> wrote:
>
> +  public static final Set<String> EMPTY_STRING_SET = Collections.emptySet();
> +

I don't know about this commit... i see a lot of EMPTY set's and maps
defined statically here.
There is no advantage to doing this, even the javadocs explain:
Implementation note: Implementations of this method need not create a
separate (Set|Map|List) object for each call. Using this method is
likely to have comparable cost to using the like-named field. (Unlike
this method, the field does not provide type safety.)

I think we should be using the Collection methods, for example on your
first file:

Index: solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java
===================================================================
--- solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java       
(revision
1056691)
+++ solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java       
(working
copy)
@@ -47,8 +47,6 @@
  */
 public abstract class AnalysisRequestHandlerBase extends RequestHandlerBase {

-  public static final Set<String> EMPTY_STRING_SET = Collections.emptySet();
-
   public void handleRequestBody(SolrQueryRequest req,
SolrQueryResponse rsp) throws Exception {
     rsp.add("analysis", doAnalysis(req));
   }
@@ -343,7 +341,7 @@
      *
      */
     public AnalysisContext(String fieldName, FieldType fieldType,
Analyzer analyzer) {
-      this(fieldName, fieldType, analyzer, EMPTY_STRING_SET);
+      this(fieldName, fieldType, analyzer, Collections.<String>emptySet());
     }

     /**
I

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

Reply via email to