FAQ

On Fri, Jan 7, 2011 at 10:47 PM, 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categorieslucene
postedJan 8, '11 at 11:34a
activeJan 8, '11 at 7:39p
posts2
users2
websitelucene.apache.org

2 users in discussion

Robert Muir: 1 post Chris Hostetter: 1 post

People

Translate

site design / logo © 2021 Grokbase