Facets: Remove stupid array->List method and use Array.asList in example

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1141518 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2011-06-30 12:53:13 +00:00
parent 295706f9f8
commit 988b53e499
3 changed files with 4 additions and 14 deletions

View File

@ -1,5 +1,6 @@
package org.apache.lucene.facet.example.multiCL;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
@ -162,7 +163,7 @@ public class MultiCLIndexer {
int nDocsAdded = 0;
int nFacetsAdded = 0;
for (int docNum = 0; docNum < SimpleUtils.docTexts.length; docNum++) {
List<CategoryPath> facetList = SimpleUtils.categoryPathArrayToList(cPaths[docNum]);
List<CategoryPath> facetList = Arrays.asList(cPaths[docNum]);
// we do not alter indexing parameters!
// a category document builder will add the categories to a document

View File

@ -1,5 +1,6 @@
package org.apache.lucene.facet.example.simple;
import java.util.Arrays;
import java.util.List;
import org.apache.lucene.document.Document;
@ -62,7 +63,7 @@ public class SimpleIndexer {
for (int docNum=0; docNum<SimpleUtils.docTexts.length; docNum++) {
// obtain the sample facets for current document
List<CategoryPath> facetList = SimpleUtils.categoryPathArrayToList(SimpleUtils.categories[docNum]);
List<CategoryPath> facetList = Arrays.asList(SimpleUtils.categories[docNum]);
// we do not alter indexing parameters!
// a category document builder will add the categories to a document once build() is called

View File

@ -72,16 +72,4 @@ public class SimpleUtils {
*/
public static final Analyzer analyzer = new WhitespaceAnalyzer(ExampleUtils.EXAMPLE_VER);
/**
* Utility method: List of category paths out of an array of them...
* @param categoryPaths input array of category paths.
*/
public static List<CategoryPath> categoryPathArrayToList (CategoryPath...categoryPaths) {
ArrayList<CategoryPath> res = new ArrayList<CategoryPath>();
for (CategoryPath categoryPath : categoryPaths) {
res.add(categoryPath);
}
return res;
}
}