You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/03/12 15:39:39 UTC
svn commit: r1576755 [13/27] - in /lucene/dev/trunk: lucene/
lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/
lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/
lucene/analysis/common/src/java/org/apache/lucene/a...
Modified: lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java Wed Mar 12 14:39:17 2014
@@ -89,7 +89,7 @@ public abstract class StrategyTestCase e
}
protected List<Document> getDocuments(Iterator<SpatialTestData> sampleData) {
- List<Document> documents = new ArrayList<Document>();
+ List<Document> documents = new ArrayList<>();
while (sampleData.hasNext()) {
SpatialTestData data = sampleData.next();
Document document = new Document();
@@ -161,7 +161,7 @@ public abstract class StrategyTestCase e
} else {
// We are looking at how the results overlap
if (concern.resultsAreSuperset) {
- Set<String> found = new HashSet<String>();
+ Set<String> found = new HashSet<>();
for (SearchResult r : got.results) {
found.add(r.document.get("id"));
}
@@ -171,7 +171,7 @@ public abstract class StrategyTestCase e
}
}
} else {
- List<String> found = new ArrayList<String>();
+ List<String> found = new ArrayList<>();
for (SearchResult r : got.results) {
found.add(r.document.get("id"));
}
@@ -237,7 +237,7 @@ public abstract class StrategyTestCase e
protected void assertOperation(Map<String,Shape> indexedDocs,
SpatialOperation operation, Shape queryShape) {
//Generate truth via brute force
- Set<String> expectedIds = new HashSet<String>();
+ Set<String> expectedIds = new HashSet<>();
for (Map.Entry<String, Shape> stringShapeEntry : indexedDocs.entrySet()) {
if (operation.evaluate(stringShapeEntry.getValue(), queryShape))
expectedIds.add(stringShapeEntry.getKey());
@@ -245,7 +245,7 @@ public abstract class StrategyTestCase e
SpatialTestQuery testQuery = new SpatialTestQuery();
testQuery.args = new SpatialArgs(operation, queryShape);
- testQuery.ids = new ArrayList<String>(expectedIds);
+ testQuery.ids = new ArrayList<>(expectedIds);
runTestQuery(SpatialMatchConcern.FILTER, testQuery);
}
Modified: lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/TestTestFramework.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/TestTestFramework.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/TestTestFramework.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/TestTestFramework.java Wed Mar 12 14:39:17 2014
@@ -45,7 +45,7 @@ public class TestTestFramework extends L
SpatialContext ctx = SpatialContext.GEO;
Iterator<SpatialTestQuery> iter = SpatialTestQuery.getTestQueries(
new SpatialArgsParser(), ctx, name, in );//closes the InputStream
- List<SpatialTestQuery> tests = new ArrayList<SpatialTestQuery>();
+ List<SpatialTestQuery> tests = new ArrayList<>();
while( iter.hasNext() ) {
tests.add( iter.next() );
}
Modified: lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/JtsPolygonTest.java Wed Mar 12 14:39:17 2014
@@ -44,7 +44,7 @@ public class JtsPolygonTest extends Stra
public JtsPolygonTest() {
try {
- HashMap<String, String> args = new HashMap<String, String>();
+ HashMap<String, String> args = new HashMap<>();
args.put("spatialContextFactory",
"com.spatial4j.core.context.jts.JtsSpatialContextFactory");
ctx = SpatialContextFactory.makeSpatialContext(args, getClass().getClassLoader());
Modified: lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/SpatialOpRecursivePrefixTreeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/SpatialOpRecursivePrefixTreeTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/SpatialOpRecursivePrefixTreeTest.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/SpatialOpRecursivePrefixTreeTest.java Wed Mar 12 14:39:17 2014
@@ -199,8 +199,8 @@ public class SpatialOpRecursivePrefixTre
final boolean biasContains = (operation == SpatialOperation.Contains);
- Map<String, Shape> indexedShapes = new LinkedHashMap<String, Shape>();
- Map<String, Shape> indexedShapesGS = new LinkedHashMap<String, Shape>();//grid snapped
+ Map<String, Shape> indexedShapes = new LinkedHashMap<>();
+ Map<String, Shape> indexedShapesGS = new LinkedHashMap<>();//grid snapped
final int numIndexedShapes = randomIntBetween(1, 6);
for (int i = 0; i < numIndexedShapes; i++) {
String id = "" + i;
@@ -257,8 +257,8 @@ public class SpatialOpRecursivePrefixTre
// We ensure true-positive matches (if the predicate on the raw shapes match
// then the search should find those same matches).
// approximations, false-positive matches
- Set<String> expectedIds = new LinkedHashSet<String>();//true-positives
- Set<String> secondaryIds = new LinkedHashSet<String>();//false-positives (unless disjoint)
+ Set<String> expectedIds = new LinkedHashSet<>();//true-positives
+ Set<String> secondaryIds = new LinkedHashSet<>();//false-positives (unless disjoint)
for (Map.Entry<String, Shape> entry : indexedShapes.entrySet()) {
String id = entry.getKey();
Shape indexedShapeCompare = entry.getValue();
@@ -297,7 +297,7 @@ public class SpatialOpRecursivePrefixTre
SpatialArgs args = new SpatialArgs(operation, queryShape);
Query query = strategy.makeQuery(args);
SearchResults got = executeQuery(query, 100);
- Set<String> remainingExpectedIds = new LinkedHashSet<String>(expectedIds);
+ Set<String> remainingExpectedIds = new LinkedHashSet<>(expectedIds);
for (SearchResult result : got.results) {
String id = result.getId();
boolean removed = remainingExpectedIds.remove(id);
@@ -334,11 +334,11 @@ public class SpatialOpRecursivePrefixTre
List<Cell> cells = grid.getCells(snapMe, detailLevel, false, true);
//calc bounding box of cells.
- List<Shape> cellShapes = new ArrayList<Shape>(cells.size());
+ List<Shape> cellShapes = new ArrayList<>(cells.size());
for (Cell cell : cells) {
cellShapes.add(cell.getShape());
}
- return new ShapeCollection<Shape>(cellShapes, ctx).getBoundingBox();
+ return new ShapeCollection<>(cellShapes, ctx).getBoundingBox();
}
/**
Modified: lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java (original)
+++ lucene/dev/trunk/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java Wed Mar 12 14:39:17 2014
@@ -123,7 +123,7 @@ public class TestRecursivePrefixTreeStra
for (double radiusDeg : radiusDegs) {
//3. Index random points in this cluster circle
deleteAll();
- List<Point> points = new ArrayList<Point>();
+ List<Point> points = new ArrayList<>();
for(int i = 0; i < 20; i++) {
//Note that this will not result in randomly distributed points in the
// circle, they will be concentrated towards the center a little. But
@@ -184,7 +184,7 @@ public class TestRecursivePrefixTreeStra
SearchResults got = executeQuery(strategy.makeQuery(args), 100);
assertEquals("" + args, assertNumFound, got.numFound);
if (assertIds != null) {
- Set<Integer> gotIds = new HashSet<Integer>();
+ Set<Integer> gotIds = new HashSet<>();
for (SearchResult result : got.results) {
gotIds.add(Integer.valueOf(result.document.get("id")));
}
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/DirectSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/DirectSpellChecker.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/DirectSpellChecker.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/DirectSpellChecker.java Wed Mar 12 14:39:17 2014
@@ -354,7 +354,7 @@ public class DirectSpellChecker {
// try ed=1 first, in case we get lucky
terms = suggestSimilar(term, inspections, ir, docfreq, 1, accuracy, spare);
if (maxEdits > 1 && terms.size() < inspections) {
- HashSet<ScoreTerm> moreTerms = new HashSet<ScoreTerm>();
+ HashSet<ScoreTerm> moreTerms = new HashSet<>();
moreTerms.addAll(terms);
moreTerms.addAll(suggestSimilar(term, inspections, ir, docfreq, maxEdits, accuracy, spare));
terms = moreTerms;
@@ -409,7 +409,7 @@ public class DirectSpellChecker {
return Collections.emptyList();
}
FuzzyTermsEnum e = new FuzzyTermsEnum(terms, atts, term, editDistance, Math.max(minPrefix, editDistance-1), true);
- final PriorityQueue<ScoreTerm> stQueue = new PriorityQueue<ScoreTerm>();
+ final PriorityQueue<ScoreTerm> stQueue = new PriorityQueue<>();
BytesRef queryTerm = new BytesRef(term.text());
BytesRef candidateTerm;
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java Wed Mar 12 14:39:17 2014
@@ -498,7 +498,7 @@ public class SpellChecker implements jav
final Directory dir = this.spellIndex;
final IndexWriter writer = new IndexWriter(dir, config);
IndexSearcher indexSearcher = obtainSearcher();
- final List<TermsEnum> termsEnums = new ArrayList<TermsEnum>();
+ final List<TermsEnum> termsEnums = new ArrayList<>();
final IndexReader reader = searcher.getIndexReader();
if (reader.maxDoc() > 0) {
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/WordBreakSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/WordBreakSpellChecker.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/WordBreakSpellChecker.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/WordBreakSpellChecker.java Wed Mar 12 14:39:17 2014
@@ -106,7 +106,7 @@ public class WordBreakSpellChecker {
int queueInitialCapacity = maxSuggestions > 10 ? 10 : maxSuggestions;
Comparator<SuggestWordArrayWrapper> queueComparator = sortMethod == BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY ? new LengthThenMaxFreqComparator()
: new LengthThenSumFreqComparator();
- Queue<SuggestWordArrayWrapper> suggestions = new PriorityQueue<SuggestWordArrayWrapper>(
+ Queue<SuggestWordArrayWrapper> suggestions = new PriorityQueue<>(
queueInitialCapacity, queueComparator);
int origFreq = ir.docFreq(term);
@@ -176,7 +176,7 @@ public class WordBreakSpellChecker {
int queueInitialCapacity = maxSuggestions > 10 ? 10 : maxSuggestions;
Comparator<CombineSuggestionWrapper> queueComparator = new CombinationsThenFreqComparator();
- Queue<CombineSuggestionWrapper> suggestions = new PriorityQueue<CombineSuggestionWrapper>(
+ Queue<CombineSuggestionWrapper> suggestions = new PriorityQueue<>(
queueInitialCapacity, queueComparator);
int thisTimeEvaluations = 0;
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java Wed Mar 12 14:39:17 2014
@@ -375,7 +375,7 @@ public class AnalyzingInfixSuggester ext
}
BooleanQuery query;
- Set<String> matchedTokens = new HashSet<String>();
+ Set<String> matchedTokens = new HashSet<>();
String prefixToken = null;
try (TokenStream ts = queryAnalyzer.tokenStream("", new StringReader(key.toString()))) {
@@ -386,7 +386,7 @@ public class AnalyzingInfixSuggester ext
String lastToken = null;
query = new BooleanQuery();
int maxEndOffset = -1;
- matchedTokens = new HashSet<String>();
+ matchedTokens = new HashSet<>();
while (ts.incrementToken()) {
if (lastToken != null) {
matchedTokens.add(lastToken);
@@ -475,7 +475,7 @@ public class AnalyzingInfixSuggester ext
// This will just be null if app didn't pass payloads to build():
// TODO: maybe just stored fields? they compress...
BinaryDocValues payloadsDV = MultiDocValues.getBinaryValues(searcher.getIndexReader(), "payloads");
- List<LookupResult> results = new ArrayList<LookupResult>();
+ List<LookupResult> results = new ArrayList<>();
BytesRef scratch = new BytesRef();
for (int i=0;i<hits.scoreDocs.length;i++) {
FieldDoc fd = (FieldDoc) hits.scoreDocs[i];
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java Wed Mar 12 14:39:17 2014
@@ -273,7 +273,7 @@ public class AnalyzingSuggester extends
// make one pass:
for(int stateNumber=states.length-1;stateNumber >=0;stateNumber--) {
final State state = states[stateNumber];
- List<Transition> newTransitions = new ArrayList<Transition>();
+ List<Transition> newTransitions = new ArrayList<>();
for(Transition t : state.getTransitions()) {
assert t.getMin() == t.getMax();
if (t.getMin() == TokenStreamToAutomaton.POS_SEP) {
@@ -470,8 +470,8 @@ public class AnalyzingSuggester extends
reader = new OfflineSorter.ByteSequencesReader(tempSorted);
- PairOutputs<Long,BytesRef> outputs = new PairOutputs<Long,BytesRef>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton());
- Builder<Pair<Long,BytesRef>> builder = new Builder<Pair<Long,BytesRef>>(FST.INPUT_TYPE.BYTE1, outputs);
+ PairOutputs<Long,BytesRef> outputs = new PairOutputs<>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton());
+ Builder<Pair<Long,BytesRef>> builder = new Builder<>(FST.INPUT_TYPE.BYTE1, outputs);
// Build FST:
BytesRef previousAnalyzed = null;
@@ -484,7 +484,7 @@ public class AnalyzingSuggester extends
// still index the hightest-weight one). We clear
// this when we see a new analyzed form, so it cannot
// grow unbounded (at most 256 entries):
- Set<BytesRef> seenSurfaceForms = new HashSet<BytesRef>();
+ Set<BytesRef> seenSurfaceForms = new HashSet<>();
int dedup = 0;
while (reader.read(scratch)) {
@@ -587,7 +587,7 @@ public class AnalyzingSuggester extends
@Override
public boolean load(DataInput input) throws IOException {
count = input.readVLong();
- this.fst = new FST<Pair<Long,BytesRef>>(input, new PairOutputs<Long,BytesRef>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
+ this.fst = new FST<>(input, new PairOutputs<>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
maxAnalyzedPathsForOneInput = input.readVInt();
hasPayloads = input.readByte() == 1;
return true;
@@ -674,9 +674,9 @@ public class AnalyzingSuggester extends
BytesReader bytesReader = fst.getBytesReader();
- FST.Arc<Pair<Long,BytesRef>> scratchArc = new FST.Arc<Pair<Long,BytesRef>>();
+ FST.Arc<Pair<Long,BytesRef>> scratchArc = new FST.Arc<>();
- final List<LookupResult> results = new ArrayList<LookupResult>();
+ final List<LookupResult> results = new ArrayList<>();
List<FSTUtil.Path<Pair<Long,BytesRef>>> prefixPaths = FSTUtil.intersectPrefixPaths(convertAutomaton(lookupAutomaton), fst);
@@ -694,7 +694,7 @@ public class AnalyzingSuggester extends
// Searcher just to find the single exact only
// match, if present:
Util.TopNSearcher<Pair<Long,BytesRef>> searcher;
- searcher = new Util.TopNSearcher<Pair<Long,BytesRef>>(fst, count * maxSurfaceFormsPerAnalyzedForm, count * maxSurfaceFormsPerAnalyzedForm, weightComparator);
+ searcher = new Util.TopNSearcher<>(fst, count * maxSurfaceFormsPerAnalyzedForm, count * maxSurfaceFormsPerAnalyzedForm, weightComparator);
// NOTE: we could almost get away with only using
// the first start node. The only catch is if
@@ -742,7 +742,7 @@ public class AnalyzingSuggester extends
num - results.size(),
num * maxAnalyzedPathsForOneInput,
weightComparator) {
- private final Set<BytesRef> seen = new HashSet<BytesRef>();
+ private final Set<BytesRef> seen = new HashSet<>();
@Override
protected boolean acceptResult(IntsRef input, Pair<Long,BytesRef> output) {
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FSTUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FSTUtil.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FSTUtil.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FSTUtil.java Wed Mar 12 14:39:17 2014
@@ -70,13 +70,13 @@ public class FSTUtil {
public static <T> List<Path<T>> intersectPrefixPaths(Automaton a, FST<T> fst)
throws IOException {
assert a.isDeterministic();
- final List<Path<T>> queue = new ArrayList<Path<T>>();
- final List<Path<T>> endNodes = new ArrayList<Path<T>>();
- queue.add(new Path<T>(a.getInitialState(), fst
+ final List<Path<T>> queue = new ArrayList<>();
+ final List<Path<T>> endNodes = new ArrayList<>();
+ queue.add(new Path<>(a.getInitialState(), fst
.getFirstArc(new FST.Arc<T>()), fst.outputs.getNoOutput(),
new IntsRef()));
- final FST.Arc<T> scratchArc = new FST.Arc<T>();
+ final FST.Arc<T> scratchArc = new FST.Arc<>();
final FST.BytesReader fstReader = fst.getBytesReader();
while (queue.size() != 0) {
@@ -100,7 +100,7 @@ public class FSTUtil {
newInput.copyInts(currentInput);
newInput.ints[currentInput.length] = t.getMin();
newInput.length = currentInput.length + 1;
- queue.add(new Path<T>(t.getDest(), new FST.Arc<T>()
+ queue.add(new Path<>(t.getDest(), new FST.Arc<T>()
.copyFrom(nextArc), fst.outputs
.add(path.output, nextArc.output), newInput));
}
@@ -122,7 +122,7 @@ public class FSTUtil {
newInput.copyInts(currentInput);
newInput.ints[currentInput.length] = nextArc.label;
newInput.length = currentInput.length + 1;
- queue.add(new Path<T>(t.getDest(), new FST.Arc<T>()
+ queue.add(new Path<>(t.getDest(), new FST.Arc<T>()
.copyFrom(nextArc), fst.outputs
.add(path.output, nextArc.output), newInput));
final int label = nextArc.label; // used in assert
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java Wed Mar 12 14:39:17 2014
@@ -343,7 +343,7 @@ public class FreeTextSuggester extends L
TermsEnum termsEnum = terms.iterator(null);
Outputs<Long> outputs = PositiveIntOutputs.getSingleton();
- Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
+ Builder<Long> builder = new Builder<>(FST.INPUT_TYPE.BYTE1, outputs);
IntsRef scratchInts = new IntsRef();
while (true) {
@@ -424,7 +424,7 @@ public class FreeTextSuggester extends L
}
totTokens = input.readVLong();
- fst = new FST<Long>(input, PositiveIntOutputs.getSingleton());
+ fst = new FST<>(input, PositiveIntOutputs.getSingleton());
return true;
}
@@ -527,7 +527,7 @@ public class FreeTextSuggester extends L
lastTokens[0] = new BytesRef();
}
- Arc<Long> arc = new Arc<Long>();
+ Arc<Long> arc = new Arc<>();
BytesReader bytesReader = fst.getBytesReader();
@@ -535,12 +535,12 @@ public class FreeTextSuggester extends L
// results, return that; else, fallback:
double backoff = 1.0;
- List<LookupResult> results = new ArrayList<LookupResult>(num);
+ List<LookupResult> results = new ArrayList<>(num);
// We only add a given suffix once, from the highest
// order model that saw it; for subsequent lower order
// models we skip it:
- final Set<BytesRef> seen = new HashSet<BytesRef>();
+ final Set<BytesRef> seen = new HashSet<>();
for(int gram=grams-1;gram>=0;gram--) {
BytesRef token = lastTokens[gram];
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletion.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletion.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletion.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletion.java Wed Mar 12 14:39:17 2014
@@ -73,7 +73,7 @@ public class FSTCompletion {
* An empty result. Keep this an {@link ArrayList} to keep all the returned
* lists of single type (monomorphic calls).
*/
- private static final ArrayList<Completion> EMPTY_RESULT = new ArrayList<Completion>();
+ private static final ArrayList<Completion> EMPTY_RESULT = new ArrayList<>();
/**
* Finite state automaton encoding all the lookup terms. See class notes for
@@ -137,12 +137,12 @@ public class FSTCompletion {
@SuppressWarnings({"unchecked","rawtypes"})
private static Arc<Object>[] cacheRootArcs(FST<Object> automaton) {
try {
- List<Arc<Object>> rootArcs = new ArrayList<Arc<Object>>();
- Arc<Object> arc = automaton.getFirstArc(new Arc<Object>());
+ List<Arc<Object>> rootArcs = new ArrayList<>();
+ Arc<Object> arc = automaton.getFirstArc(new Arc<>());
FST.BytesReader fstReader = automaton.getBytesReader();
automaton.readFirstTargetArc(arc, arc, fstReader);
while (true) {
- rootArcs.add(new Arc<Object>().copyFrom(arc));
+ rootArcs.add(new Arc<>().copyFrom(arc));
if (arc.isLast()) break;
automaton.readNextArc(arc, fstReader);
}
@@ -172,7 +172,7 @@ public class FSTCompletion {
int rootArcIndex, BytesRef utf8) {
// Get the UTF-8 bytes representation of the input key.
try {
- final FST.Arc<Object> scratch = new FST.Arc<Object>();
+ final FST.Arc<Object> scratch = new FST.Arc<>();
FST.BytesReader fstReader = automaton.getBytesReader();
for (; rootArcIndex < rootArcs.length; rootArcIndex++) {
final FST.Arc<Object> rootArc = rootArcs[rootArcIndex];
@@ -261,12 +261,12 @@ public class FSTCompletion {
// Don't overallocate the results buffers. This also serves the purpose of
// allowing the user of this class to request all matches using Integer.MAX_VALUE as
// the number of results.
- final ArrayList<Completion> res = new ArrayList<Completion>(Math.min(10, num));
+ final ArrayList<Completion> res = new ArrayList<>(Math.min(10, num));
final BytesRef output = BytesRef.deepCopyOf(key);
for (int i = 0; i < rootArcs.length; i++) {
final FST.Arc<Object> rootArc = rootArcs[i];
- final FST.Arc<Object> arc = new FST.Arc<Object>().copyFrom(rootArc);
+ final FST.Arc<Object> arc = new FST.Arc<>().copyFrom(rootArc);
// Descend into the automaton using the key as prefix.
if (descendWithPrefix(arc, key)) {
@@ -370,7 +370,7 @@ public class FSTCompletion {
if (res.size() >= num) return true;
} else {
int save = output.length;
- if (collect(res, num, bucket, output, new Arc<Object>().copyFrom(arc))) {
+ if (collect(res, num, bucket, output, new Arc<>().copyFrom(arc))) {
return true;
}
output.length = save;
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java Wed Mar 12 14:39:17 2014
@@ -237,7 +237,7 @@ public class FSTCompletionBuilder {
// Build the automaton.
final Outputs<Object> outputs = NoOutputs.getSingleton();
final Object empty = outputs.getNoOutput();
- final Builder<Object> builder = new Builder<Object>(
+ final Builder<Object> builder = new Builder<>(
FST.INPUT_TYPE.BYTE1, 0, 0, true, true,
shareMaxTailLength, outputs, null, false,
PackedInts.DEFAULT, true, 15);
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java Wed Mar 12 14:39:17 2014
@@ -251,7 +251,7 @@ public class FSTCompletionLookup extends
completions = normalCompletion.lookup(key, num);
}
- final ArrayList<LookupResult> results = new ArrayList<LookupResult>(completions.size());
+ final ArrayList<LookupResult> results = new ArrayList<>(completions.size());
CharsRef spare = new CharsRef();
for (Completion c : completions) {
spare.grow(c.utf8.length);
@@ -283,7 +283,7 @@ public class FSTCompletionLookup extends
@Override
public synchronized boolean load(DataInput input) throws IOException {
count = input.readVLong();
- this.higherWeightsCompletion = new FSTCompletion(new FST<Object>(
+ this.higherWeightsCompletion = new FSTCompletion(new FST<>(
input, NoOutputs.getSingleton()));
this.normalCompletion = new FSTCompletion(
higherWeightsCompletion.getFST(), false, exactMatchFirst);
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java Wed Mar 12 14:39:17 2014
@@ -102,7 +102,7 @@ public class WFSTCompletionLookup extend
IntsRef scratchInts = new IntsRef();
BytesRef previous = null;
PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
- Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
+ Builder<Long> builder = new Builder<>(FST.INPUT_TYPE.BYTE1, outputs);
while ((scratch = iter.next()) != null) {
long cost = iter.weight();
@@ -134,7 +134,7 @@ public class WFSTCompletionLookup extend
@Override
public boolean load(DataInput input) throws IOException {
count = input.readVLong();
- this.fst = new FST<Long>(input, PositiveIntOutputs.getSingleton());
+ this.fst = new FST<>(input, PositiveIntOutputs.getSingleton());
return true;
}
@@ -152,7 +152,7 @@ public class WFSTCompletionLookup extend
BytesRef scratch = new BytesRef(key);
int prefixLength = scratch.length;
- Arc<Long> arc = new Arc<Long>();
+ Arc<Long> arc = new Arc<>();
// match the prefix portion exactly
Long prefixOutput = null;
@@ -161,10 +161,10 @@ public class WFSTCompletionLookup extend
} catch (IOException bogus) { throw new RuntimeException(bogus); }
if (prefixOutput == null) {
- return Collections.<LookupResult>emptyList();
+ return Collections.emptyList();
}
- List<LookupResult> results = new ArrayList<LookupResult>(num);
+ List<LookupResult> results = new ArrayList<>(num);
CharsRef spare = new CharsRef();
if (exactFirst && arc.isFinal()) {
spare.grow(scratch.length);
@@ -225,7 +225,7 @@ public class WFSTCompletionLookup extend
if (fst == null) {
return null;
}
- Arc<Long> arc = new Arc<Long>();
+ Arc<Long> arc = new Arc<>();
Long result = null;
try {
result = lookupPrefix(new BytesRef(key), arc);
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java Wed Mar 12 14:39:17 2014
@@ -96,7 +96,7 @@ public class JaspellLookup extends Looku
@Override
public List<LookupResult> lookup(CharSequence key, boolean onlyMorePopular, int num) {
- List<LookupResult> res = new ArrayList<LookupResult>();
+ List<LookupResult> res = new ArrayList<>();
List<String> list;
int count = onlyMorePopular ? num * 2 : num;
if (usePrefix) {
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java Wed Mar 12 14:39:17 2014
@@ -682,7 +682,7 @@ public class JaspellTernarySearchTrie {
*@return A <code>List</code> with the results
*/
public List<String> matchPrefix(CharSequence prefix, int numReturnValues) {
- Vector<String> sortKeysResult = new Vector<String>();
+ Vector<String> sortKeysResult = new Vector<>();
TSTNode startNode = getNode(prefix);
if (startNode == null) {
return sortKeysResult;
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java Wed Mar 12 14:39:17 2014
@@ -114,7 +114,7 @@ public class TSTAutocomplete {
CharSequence s, int x) {
TernaryTreeNode p = root;
- ArrayList<TernaryTreeNode> suggest = new ArrayList<TernaryTreeNode>();
+ ArrayList<TernaryTreeNode> suggest = new ArrayList<>();
while (p != null) {
if (s.charAt(x) < p.splitchar) {
@@ -143,7 +143,7 @@ public class TSTAutocomplete {
}
p = p.eqKid;
- Stack<TernaryTreeNode> st = new Stack<TernaryTreeNode>();
+ Stack<TernaryTreeNode> st = new Stack<>();
st.push(p);
while (!st.empty()) {
TernaryTreeNode top = st.peek();
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java Wed Mar 12 14:39:17 2014
@@ -60,8 +60,8 @@ public class TSTLookup extends Lookup {
// make sure it's sorted and the comparator uses UTF16 sort order
iterator = new SortedInputIterator(iterator, BytesRef.getUTF8SortedAsUTF16Comparator());
count = 0;
- ArrayList<String> tokens = new ArrayList<String>();
- ArrayList<Number> vals = new ArrayList<Number>();
+ ArrayList<String> tokens = new ArrayList<>();
+ ArrayList<Number> vals = new ArrayList<>();
BytesRef spare;
CharsRef charsSpare = new CharsRef();
while ((spare = iterator.next()) != null) {
@@ -119,7 +119,7 @@ public class TSTLookup extends Lookup {
@Override
public List<LookupResult> lookup(CharSequence key, boolean onlyMorePopular, int num) {
List<TernaryTreeNode> list = autocomplete.prefixCompletion(root, key, 0);
- List<LookupResult> res = new ArrayList<LookupResult>();
+ List<LookupResult> res = new ArrayList<>();
if (list == null || list.size() == 0) {
return res;
}
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java Wed Mar 12 14:39:17 2014
@@ -272,8 +272,8 @@ public class TestWordBreakSpellChecker e
writer = new RandomIndexWriter(random(), dir, new MockAnalyzer(random(),
MockTokenizer.WHITESPACE, false));
int maxLength = TestUtil.nextInt(random(), 5, 50);
- List<String> originals = new ArrayList<String>(numDocs);
- List<String[]> breaks = new ArrayList<String[]>(numDocs);
+ List<String> originals = new ArrayList<>(numDocs);
+ List<String[]> breaks = new ArrayList<>(numDocs);
for (int i = 0; i < numDocs; i++) {
String orig = "";
if (random().nextBoolean()) {
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentDictionaryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentDictionaryTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentDictionaryTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentDictionaryTest.java Wed Mar 12 14:39:17 2014
@@ -95,7 +95,7 @@ public class DocumentDictionaryTest exte
docs.put(term, doc);
}
- return new SimpleEntry<List<String>, Map<String, Document>>(invalidDocTerms, docs);
+ return new SimpleEntry<>(invalidDocTerms, docs);
}
@Test
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java Wed Mar 12 14:39:17 2014
@@ -53,7 +53,7 @@ public class FileDictionaryTest extends
entryValues.add(payload);
}
sb.append("\n");
- return new SimpleEntry<List<String>, String>(entryValues, sb.toString());
+ return new SimpleEntry<>(entryValues, sb.toString());
}
private Map.Entry<List<List<String>>,String> generateFileInput(int count, String fieldDelimiter, boolean hasWeights, boolean hasPayloads) {
@@ -68,7 +68,7 @@ public class FileDictionaryTest extends
entries.add(entrySet.getKey());
sb.append(entrySet.getValue());
}
- return new SimpleEntry<List<List<String>>, String>(entries, sb.toString());
+ return new SimpleEntry<>(entries, sb.toString());
}
@Test
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java Wed Mar 12 14:39:17 2014
@@ -98,7 +98,7 @@ public class LookupBenchmarkTest extends
* Collect the multilingual input for benchmarks/ tests.
*/
public static List<Input> readTop50KWiki() throws Exception {
- List<Input> input = new ArrayList<Input>();
+ List<Input> input = new ArrayList<>();
URL resource = LookupBenchmarkTest.class.getResource("Top50KWiki.utf8");
assert resource != null : "Resource missing: Top50KWiki.utf8";
@@ -211,7 +211,7 @@ public class LookupBenchmarkTest extends
for (Class<? extends Lookup> cls : benchmarkClasses) {
final Lookup lookup = buildLookup(cls, dictionaryInput);
- final List<String> input = new ArrayList<String>(benchmarkInput.size());
+ final List<String> input = new ArrayList<>(benchmarkInput.size());
for (Input tf : benchmarkInput) {
String s = tf.term.utf8ToString();
String sub = s.substring(0, Math.min(s.length(),
@@ -246,7 +246,7 @@ public class LookupBenchmarkTest extends
final double NANOS_PER_MS = 1000000;
try {
- List<Double> times = new ArrayList<Double>();
+ List<Double> times = new ArrayList<>();
for (int i = 0; i < warmup + rounds; i++) {
final long start = System.nanoTime();
guard = callable.call().intValue();
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggesterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggesterTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggesterTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggesterTest.java Wed Mar 12 14:39:17 2014
@@ -148,7 +148,7 @@ public class AnalyzingInfixSuggesterTest
CharTermAttribute termAtt = ts.addAttribute(CharTermAttribute.class);
OffsetAttribute offsetAtt = ts.addAttribute(OffsetAttribute.class);
ts.reset();
- List<LookupHighlightFragment> fragments = new ArrayList<LookupHighlightFragment>();
+ List<LookupHighlightFragment> fragments = new ArrayList<>();
int upto = 0;
while (ts.incrementToken()) {
String token = termAtt.toString();
@@ -492,11 +492,11 @@ public class AnalyzingInfixSuggesterTest
int iters = atLeast(1000);
int visibleUpto = 0;
- Set<Long> usedWeights = new HashSet<Long>();
- Set<String> usedKeys = new HashSet<String>();
+ Set<Long> usedWeights = new HashSet<>();
+ Set<String> usedKeys = new HashSet<>();
- List<Input> inputs = new ArrayList<Input>();
- List<Update> pendingUpdates = new ArrayList<Update>();
+ List<Input> inputs = new ArrayList<>();
+ List<Update> pendingUpdates = new ArrayList<>();
for(int iter=0;iter<iters;iter++) {
String text;
@@ -590,7 +590,7 @@ public class AnalyzingInfixSuggesterTest
}
// Stupid slow but hopefully correct matching:
- List<Input> expected = new ArrayList<Input>();
+ List<Input> expected = new ArrayList<>();
for(int i=0;i<visibleUpto;i++) {
Input input = inputs.get(i);
String[] inputTerms = input.term.utf8ToString().split("\\s");
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java Wed Mar 12 14:39:17 2014
@@ -648,9 +648,9 @@ public class AnalyzingSuggesterTest exte
int numQueries = atLeast(1000);
- final List<TermFreq2> slowCompletor = new ArrayList<TermFreq2>();
- final TreeSet<String> allPrefixes = new TreeSet<String>();
- final Set<String> seen = new HashSet<String>();
+ final List<TermFreq2> slowCompletor = new ArrayList<>();
+ final TreeSet<String> allPrefixes = new TreeSet<>();
+ final Set<String> seen = new HashSet<>();
boolean doPayloads = random().nextBoolean();
@@ -742,7 +742,7 @@ public class AnalyzingSuggesterTest exte
if (VERBOSE) {
// Don't just sort original list, to avoid VERBOSE
// altering the test:
- List<TermFreq2> sorted = new ArrayList<TermFreq2>(slowCompletor);
+ List<TermFreq2> sorted = new ArrayList<>(slowCompletor);
Collections.sort(sorted);
for(TermFreq2 ent : sorted) {
System.out.println(" surface='" + ent.surfaceForm + "' analyzed='" + ent.analyzedForm + "' weight=" + ent.weight);
@@ -768,7 +768,7 @@ public class AnalyzingSuggesterTest exte
List<LookupResult> r = suggester.lookup(TestUtil.stringToCharSequence(prefix, random()), false, topN);
// 2. go thru whole set to find suggestions:
- List<TermFreq2> matches = new ArrayList<TermFreq2>();
+ List<TermFreq2> matches = new ArrayList<>();
// "Analyze" the key:
String[] tokens = prefix.split(" ");
@@ -1194,7 +1194,7 @@ public class AnalyzingSuggesterTest exte
@SafeVarargs
public final <T> Iterable<T> shuffle(T...values) {
- final List<T> asList = new ArrayList<T>(values.length);
+ final List<T> asList = new ArrayList<>(values.length);
for (T value : values) {
asList.add(value);
}
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java Wed Mar 12 14:39:17 2014
@@ -54,7 +54,7 @@ import org.apache.lucene.util.fst.Util;
public class FuzzySuggesterTest extends LuceneTestCase {
public void testRandomEdits() throws IOException {
- List<Input> keys = new ArrayList<Input>();
+ List<Input> keys = new ArrayList<>();
int numTerms = atLeast(100);
for (int i = 0; i < numTerms; i++) {
keys.add(new Input("boo" + TestUtil.randomSimpleString(random()), 1 + random().nextInt(100)));
@@ -75,7 +75,7 @@ public class FuzzySuggesterTest extends
}
public void testNonLatinRandomEdits() throws IOException {
- List<Input> keys = new ArrayList<Input>();
+ List<Input> keys = new ArrayList<>();
int numTerms = atLeast(100);
for (int i = 0; i < numTerms; i++) {
keys.add(new Input("бÑÑ" + TestUtil.randomSimpleString(random()), 1 + random().nextInt(100)));
@@ -596,9 +596,9 @@ public class FuzzySuggesterTest extends
int numQueries = atLeast(100);
- final List<TermFreqPayload2> slowCompletor = new ArrayList<TermFreqPayload2>();
- final TreeSet<String> allPrefixes = new TreeSet<String>();
- final Set<String> seen = new HashSet<String>();
+ final List<TermFreqPayload2> slowCompletor = new ArrayList<>();
+ final TreeSet<String> allPrefixes = new TreeSet<>();
+ final Set<String> seen = new HashSet<>();
Input[] keys = new Input[numQueries];
@@ -674,7 +674,7 @@ public class FuzzySuggesterTest extends
if (VERBOSE) {
// Don't just sort original list, to avoid VERBOSE
// altering the test:
- List<TermFreqPayload2> sorted = new ArrayList<TermFreqPayload2>(slowCompletor);
+ List<TermFreqPayload2> sorted = new ArrayList<>(slowCompletor);
Collections.sort(sorted);
for(TermFreqPayload2 ent : sorted) {
System.out.println(" surface='" + ent.surfaceForm + " analyzed='" + ent.analyzedForm + "' weight=" + ent.weight);
@@ -696,7 +696,7 @@ public class FuzzySuggesterTest extends
List<LookupResult> r = suggester.lookup(TestUtil.stringToCharSequence(prefix, random()), false, topN);
// 2. go thru whole set to find suggestions:
- List<LookupResult> matches = new ArrayList<LookupResult>();
+ List<LookupResult> matches = new ArrayList<>();
// "Analyze" the key:
String[] tokens = prefix.split(" ");
@@ -929,8 +929,8 @@ public class FuzzySuggesterTest extends
public void testRandom2() throws Throwable {
final int NUM = atLeast(200);
- final List<Input> answers = new ArrayList<Input>();
- final Set<String> seen = new HashSet<String>();
+ final List<Input> answers = new ArrayList<>();
+ final Set<String> seen = new HashSet<>();
for(int i=0;i<NUM;i++) {
final String s = randomSimpleString(8);
if (!seen.contains(s)) {
@@ -1005,7 +1005,7 @@ public class FuzzySuggesterTest extends
}
private List<LookupResult> slowFuzzyMatch(int prefixLen, int maxEdits, boolean allowTransposition, List<Input> answers, String frag) {
- final List<LookupResult> results = new ArrayList<LookupResult>();
+ final List<LookupResult> results = new ArrayList<>();
final int fragLen = frag.length();
for(Input tf : answers) {
//System.out.println(" check s=" + tf.term.utf8ToString());
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/TestFreeTextSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/TestFreeTextSuggester.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/TestFreeTextSuggester.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/TestFreeTextSuggester.java Wed Mar 12 14:39:17 2014
@@ -293,7 +293,7 @@ public class TestFreeTextSuggester exten
public void testRandom() throws IOException {
String[] terms = new String[TestUtil.nextInt(random(), 2, 10)];
- Set<String> seen = new HashSet<String>();
+ Set<String> seen = new HashSet<>();
while (seen.size() < terms.length) {
String token = TestUtil.randomSimpleString(random(), 1, 5);
if (!seen.contains(token)) {
@@ -367,12 +367,12 @@ public class TestFreeTextSuggester exten
});
// Build inefficient but hopefully correct model:
- List<Map<String,Integer>> gramCounts = new ArrayList<Map<String,Integer>>(grams);
+ List<Map<String,Integer>> gramCounts = new ArrayList<>(grams);
for(int gram=0;gram<grams;gram++) {
if (VERBOSE) {
System.out.println("TEST: build model for gram=" + gram);
}
- Map<String,Integer> model = new HashMap<String,Integer>();
+ Map<String,Integer> model = new HashMap<>();
gramCounts.add(model);
for(String[] doc : docs) {
for(int i=0;i<doc.length-gram;i++) {
@@ -429,9 +429,9 @@ public class TestFreeTextSuggester exten
}
// Expected:
- List<LookupResult> expected = new ArrayList<LookupResult>();
+ List<LookupResult> expected = new ArrayList<>();
double backoff = 1.0;
- seen = new HashSet<String>();
+ seen = new HashSet<>();
if (VERBOSE) {
System.out.println(" compute expected");
@@ -494,7 +494,7 @@ public class TestFreeTextSuggester exten
if (VERBOSE) {
System.out.println(" find terms w/ prefix=" + tokens[tokens.length-1]);
}
- List<LookupResult> tmp = new ArrayList<LookupResult>();
+ List<LookupResult> tmp = new ArrayList<>();
for(String term : terms) {
if (term.startsWith(tokens[tokens.length-1])) {
if (VERBOSE) {
@@ -587,7 +587,7 @@ public class TestFreeTextSuggester exten
@SafeVarargs
private final <T> Iterable<T> shuffle(T...values) {
- final List<T> asList = new ArrayList<T>(values.length);
+ final List<T> asList = new ArrayList<>(values.length);
for (T value : values) {
asList.add(value);
}
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java Wed Mar 12 14:39:17 2014
@@ -157,7 +157,7 @@ public class FSTCompletionTest extends L
FSTCompletionLookup lookup = new FSTCompletionLookup(10, true);
Random r = random();
- List<Input> keys = new ArrayList<Input>();
+ List<Input> keys = new ArrayList<>();
for (int i = 0; i < 5000; i++) {
keys.add(new Input(TestUtil.randomSimpleString(r), -1));
}
@@ -199,7 +199,7 @@ public class FSTCompletionTest extends L
}
public void testRandom() throws Exception {
- List<Input> freqs = new ArrayList<Input>();
+ List<Input> freqs = new ArrayList<>();
Random rnd = random();
for (int i = 0; i < 2500 + rnd.nextInt(2500); i++) {
int weight = rnd.nextInt(100);
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java Wed Mar 12 14:39:17 2014
@@ -128,8 +128,8 @@ public class WFSTCompletionTest extends
public void testRandom() throws Exception {
int numWords = atLeast(1000);
- final TreeMap<String,Long> slowCompletor = new TreeMap<String,Long>();
- final TreeSet<String> allPrefixes = new TreeSet<String>();
+ final TreeMap<String,Long> slowCompletor = new TreeMap<>();
+ final TreeSet<String> allPrefixes = new TreeSet<>();
Input[] keys = new Input[numWords];
@@ -163,7 +163,7 @@ public class WFSTCompletionTest extends
List<LookupResult> r = suggester.lookup(TestUtil.stringToCharSequence(prefix, random), false, topN);
// 2. go thru whole treemap (slowCompletor) and check its actually the best suggestion
- final List<LookupResult> matches = new ArrayList<LookupResult>();
+ final List<LookupResult> matches = new ArrayList<>();
// TODO: could be faster... but its slowCompletor for a reason
for (Map.Entry<String,Long> e : slowCompletor.entrySet()) {
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java Wed Mar 12 14:39:17 2014
@@ -154,8 +154,8 @@ public abstract class BaseTokenStreamTes
}
// Maps position to the start/end offset:
- final Map<Integer,Integer> posToStartOffset = new HashMap<Integer,Integer>();
- final Map<Integer,Integer> posToEndOffset = new HashMap<Integer,Integer>();
+ final Map<Integer,Integer> posToStartOffset = new HashMap<>();
+ final Map<Integer,Integer> posToEndOffset = new HashMap<>();
ts.reset();
int pos = -1;
@@ -682,12 +682,12 @@ public abstract class BaseTokenStreamTes
PositionIncrementAttribute posIncAtt = ts.hasAttribute(PositionIncrementAttribute.class) ? ts.getAttribute(PositionIncrementAttribute.class) : null;
PositionLengthAttribute posLengthAtt = ts.hasAttribute(PositionLengthAttribute.class) ? ts.getAttribute(PositionLengthAttribute.class) : null;
TypeAttribute typeAtt = ts.hasAttribute(TypeAttribute.class) ? ts.getAttribute(TypeAttribute.class) : null;
- List<String> tokens = new ArrayList<String>();
- List<String> types = new ArrayList<String>();
- List<Integer> positions = new ArrayList<Integer>();
- List<Integer> positionLengths = new ArrayList<Integer>();
- List<Integer> startOffsets = new ArrayList<Integer>();
- List<Integer> endOffsets = new ArrayList<Integer>();
+ List<String> tokens = new ArrayList<>();
+ List<String> types = new ArrayList<>();
+ List<Integer> positions = new ArrayList<>();
+ List<Integer> positionLengths = new ArrayList<>();
+ List<Integer> startOffsets = new ArrayList<>();
+ List<Integer> endOffsets = new ArrayList<>();
ts.reset();
// First pass: save away "correct" tokens
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java Wed Mar 12 14:39:17 2014
@@ -251,7 +251,7 @@ public abstract class CollationTestBase
public void assertThreadSafe(final Analyzer analyzer) throws Exception {
int numTestPoints = 100;
int numThreads = TestUtil.nextInt(random(), 3, 5);
- final HashMap<String,BytesRef> map = new HashMap<String,BytesRef>();
+ final HashMap<String,BytesRef> map = new HashMap<>();
// create a map<String,SortKey> up front.
// then with multiple threads, generate sort keys for all the keys in the map
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/LookaheadTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/LookaheadTokenFilter.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/LookaheadTokenFilter.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/LookaheadTokenFilter.java Wed Mar 12 14:39:17 2014
@@ -59,7 +59,7 @@ public abstract class LookaheadTokenFilt
* to record other state at each position. */
protected static class Position implements RollingBuffer.Resettable {
// Buffered input tokens at this position:
- public final List<AttributeSource.State> inputTokens = new ArrayList<AttributeSource.State>();
+ public final List<AttributeSource.State> inputTokens = new ArrayList<>();
// Next buffered token to be returned to consumer:
public int nextRead;
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java Wed Mar 12 14:39:17 2014
@@ -48,7 +48,7 @@ public final class MockAnalyzer extends
private int positionIncrementGap;
private Integer offsetGap;
private final Random random;
- private Map<String,Integer> previousMappings = new HashMap<String,Integer>();
+ private Map<String,Integer> previousMappings = new HashMap<>();
private boolean enableChecks = true;
private int maxTokenLength = MockTokenizer.DEFAULT_MAX_TOKEN_LENGTH;
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockCharFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockCharFilter.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockCharFilter.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockCharFilter.java Wed Mar 12 14:39:17 2014
@@ -100,5 +100,5 @@ public class MockCharFilter extends Char
corrections.put(off, cumulativeDiff);
}
- TreeMap<Integer,Integer> corrections = new TreeMap<Integer,Integer>();
+ TreeMap<Integer,Integer> corrections = new TreeMap<>();
}
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/ValidatingTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/ValidatingTokenFilter.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/ValidatingTokenFilter.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/ValidatingTokenFilter.java Wed Mar 12 14:39:17 2014
@@ -44,8 +44,8 @@ public final class ValidatingTokenFilter
private int lastStartOffset;
// Maps position to the start/end offset:
- private final Map<Integer,Integer> posToStartOffset = new HashMap<Integer,Integer>();
- private final Map<Integer,Integer> posToEndOffset = new HashMap<Integer,Integer>();
+ private final Map<Integer,Integer> posToStartOffset = new HashMap<>();
+ private final Map<Integer,Integer> posToEndOffset = new HashMap<>();
private final PositionIncrementAttribute posIncAtt = getAttrIfExists(PositionIncrementAttribute.class);
private final PositionLengthAttribute posLenAtt = getAttrIfExists(PositionLengthAttribute.class);
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java Wed Mar 12 14:39:17 2014
@@ -155,7 +155,7 @@ class Lucene40DocValuesWriter extends Do
@Override
public void addBinaryField(FieldInfo field, Iterable<BytesRef> values) throws IOException {
// examine the values to determine best type to use
- HashSet<BytesRef> uniqueValues = new HashSet<BytesRef>();
+ HashSet<BytesRef> uniqueValues = new HashSet<>();
int minLength = Integer.MAX_VALUE;
int maxLength = Integer.MIN_VALUE;
for (BytesRef b : values) {
@@ -314,7 +314,7 @@ class Lucene40DocValuesWriter extends Do
Lucene40DocValuesFormat.BYTES_FIXED_DEREF_VERSION_CURRENT);
// deduplicate
- TreeSet<BytesRef> dictionary = new TreeSet<BytesRef>();
+ TreeSet<BytesRef> dictionary = new TreeSet<>();
for (BytesRef v : values) {
dictionary.add(v == null ? new BytesRef() : BytesRef.deepCopyOf(v));
}
@@ -354,7 +354,7 @@ class Lucene40DocValuesWriter extends Do
Lucene40DocValuesFormat.BYTES_VAR_DEREF_VERSION_CURRENT);
// deduplicate
- TreeSet<BytesRef> dictionary = new TreeSet<BytesRef>();
+ TreeSet<BytesRef> dictionary = new TreeSet<>();
for (BytesRef v : values) {
dictionary.add(v == null ? new BytesRef() : BytesRef.deepCopyOf(v));
}
@@ -362,7 +362,7 @@ class Lucene40DocValuesWriter extends Do
/* values */
long startPosition = data.getFilePointer();
long currentAddress = 0;
- HashMap<BytesRef,Long> valueToAddress = new HashMap<BytesRef,Long>();
+ HashMap<BytesRef,Long> valueToAddress = new HashMap<>();
for (BytesRef v : dictionary) {
currentAddress = data.getFilePointer() - startPosition;
valueToAddress.put(v, currentAddress);
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java Wed Mar 12 14:39:17 2014
@@ -144,7 +144,7 @@ class Lucene42DocValuesConsumer extends
} else {
meta.writeByte(TABLE_COMPRESSED); // table-compressed
Long[] decode = uniqueValues.toArray(new Long[uniqueValues.size()]);
- final HashMap<Long,Integer> encode = new HashMap<Long,Integer>();
+ final HashMap<Long,Integer> encode = new HashMap<>();
data.writeVInt(decode.length);
for (int i = 0; i < decode.length; i++) {
data.writeLong(decode[i]);
@@ -252,7 +252,7 @@ class Lucene42DocValuesConsumer extends
meta.writeByte(FST);
meta.writeLong(data.getFilePointer());
PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
- Builder<Long> builder = new Builder<Long>(INPUT_TYPE.BYTE1, outputs);
+ Builder<Long> builder = new Builder<>(INPUT_TYPE.BYTE1, outputs);
IntsRef scratch = new IntsRef();
long ord = 0;
for (BytesRef v : values) {
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java Wed Mar 12 14:39:17 2014
@@ -96,7 +96,7 @@ public final class MockRandomPostingsFor
// Chooses random IntStreamFactory depending on file's extension
private static class MockIntStreamFactory extends IntStreamFactory {
private final int salt;
- private final List<IntStreamFactory> delegates = new ArrayList<IntStreamFactory>();
+ private final List<IntStreamFactory> delegates = new ArrayList<>();
public MockIntStreamFactory(Random random) {
salt = random.nextInt();
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java Wed Mar 12 14:39:17 2014
@@ -65,7 +65,7 @@ public final class RAMOnlyPostingsFormat
// Postings state:
static class RAMPostings extends FieldsProducer {
- final Map<String,RAMField> fieldToTerms = new TreeMap<String,RAMField>();
+ final Map<String,RAMField> fieldToTerms = new TreeMap<>();
@Override
public Terms terms(String field) {
@@ -98,7 +98,7 @@ public final class RAMOnlyPostingsFormat
static class RAMField extends Terms {
final String field;
- final SortedMap<String,RAMTerm> termToDocs = new TreeMap<String,RAMTerm>();
+ final SortedMap<String,RAMTerm> termToDocs = new TreeMap<>();
long sumTotalTermFreq;
long sumDocFreq;
int docCount;
@@ -167,7 +167,7 @@ public final class RAMOnlyPostingsFormat
static class RAMTerm {
final String term;
long totalTermFreq;
- final List<RAMDoc> docs = new ArrayList<RAMDoc>();
+ final List<RAMDoc> docs = new ArrayList<>();
public RAMTerm(String term) {
this.term = term;
}
@@ -599,7 +599,7 @@ public final class RAMOnlyPostingsFormat
}
// Holds all indexes created, keyed by the ID assigned in fieldsConsumer
- private final Map<Integer,RAMPostings> state = new HashMap<Integer,RAMPostings>();
+ private final Map<Integer,RAMPostings> state = new HashMap<>();
private final AtomicInteger nextID = new AtomicInteger();
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java Wed Mar 12 14:39:17 2014
@@ -48,7 +48,7 @@ public abstract class BaseCompressingDoc
final IndexWriter iwriter = new IndexWriter(dir, iwc);
final int uniqueValueCount = TestUtil.nextInt(random(), 1, 256);
- final List<Long> values = new ArrayList<Long>();
+ final List<Long> values = new ArrayList<>();
final Document doc = new Document();
final NumericDocValuesField dvf = new NumericDocValuesField("dv", 0);
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java Wed Mar 12 14:39:17 2014
@@ -1138,7 +1138,7 @@ public abstract class BaseDocValuesForma
RandomIndexWriter w = new RandomIndexWriter(random(), dir, cfg);
int numDocs = atLeast(100);
BytesRefHash hash = new BytesRefHash();
- Map<String, String> docToString = new HashMap<String, String>();
+ Map<String, String> docToString = new HashMap<>();
int maxLength = TestUtil.nextInt(random(), 1, 50);
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
@@ -2086,7 +2086,7 @@ public abstract class BaseDocValuesForma
}
int numValues = TestUtil.nextInt(random(), 0, maxValuesPerDoc);
// create a random set of strings
- Set<String> values = new TreeSet<String>();
+ Set<String> values = new TreeSet<>();
for (int v = 0; v < numValues; v++) {
values.add(TestUtil.randomSimpleString(random(), length));
}
@@ -2097,7 +2097,7 @@ public abstract class BaseDocValuesForma
}
// add in any order to the dv field
- ArrayList<String> unordered = new ArrayList<String>(values);
+ ArrayList<String> unordered = new ArrayList<>(values);
Collections.shuffle(unordered, random());
for (String v : unordered) {
doc.add(new SortedSetDocValuesField("dv", new BytesRef(v)));
@@ -2303,20 +2303,20 @@ public abstract class BaseDocValuesForma
}
int numValues = random().nextInt(17);
// create a random list of strings
- List<String> values = new ArrayList<String>();
+ List<String> values = new ArrayList<>();
for (int v = 0; v < numValues; v++) {
values.add(TestUtil.randomSimpleString(random(), length));
}
// add in any order to the indexed field
- ArrayList<String> unordered = new ArrayList<String>(values);
+ ArrayList<String> unordered = new ArrayList<>(values);
Collections.shuffle(unordered, random());
for (String v : values) {
doc.add(newStringField("indexed", v, Field.Store.NO));
}
// add in any order to the dv field
- ArrayList<String> unordered2 = new ArrayList<String>(values);
+ ArrayList<String> unordered2 = new ArrayList<>(values);
Collections.shuffle(unordered2, random());
for (String v : unordered2) {
doc.add(new SortedSetDocValuesField("dv", new BytesRef(v)));
@@ -2628,7 +2628,7 @@ public abstract class BaseDocValuesForma
numDocs = TestUtil.nextInt(random(), 100, 200);
}
IndexWriter w = new IndexWriter(d, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
- List<byte[]> docBytes = new ArrayList<byte[]>();
+ List<byte[]> docBytes = new ArrayList<>();
long totalBytes = 0;
for(int docID=0;docID<numDocs;docID++) {
// we don't use RandomIndexWriter because it might add
@@ -2726,7 +2726,7 @@ public abstract class BaseDocValuesForma
numDocs = TestUtil.nextInt(random(), 100, 200);
}
IndexWriter w = new IndexWriter(d, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
- List<byte[]> docBytes = new ArrayList<byte[]>();
+ List<byte[]> docBytes = new ArrayList<>();
long totalBytes = 0;
for(int docID=0;docID<numDocs;docID++) {
// we don't use RandomIndexWriter because it might add
@@ -2905,7 +2905,7 @@ public abstract class BaseDocValuesForma
doc.add(dvNumericField);
}
int numSortedSetFields = random().nextInt(3);
- Set<String> values = new TreeSet<String>();
+ Set<String> values = new TreeSet<>();
for (int j = 0; j < numSortedSetFields; j++) {
values.add(TestUtil.randomSimpleString(random()));
}
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java Wed Mar 12 14:39:17 2014
@@ -341,7 +341,7 @@ public abstract class BasePostingsFormat
public static void createPostings() throws IOException {
totalPostings = 0;
totalPayloadBytes = 0;
- fields = new TreeMap<String,SortedMap<BytesRef,Long>>();
+ fields = new TreeMap<>();
final int numFields = TestUtil.nextInt(random(), 1, 5);
if (VERBOSE) {
@@ -362,9 +362,9 @@ public abstract class BasePostingsFormat
null, DocValuesType.NUMERIC, null);
fieldUpto++;
- SortedMap<BytesRef,Long> postings = new TreeMap<BytesRef,Long>();
+ SortedMap<BytesRef,Long> postings = new TreeMap<>();
fields.put(field, postings);
- Set<String> seenTerms = new HashSet<String>();
+ Set<String> seenTerms = new HashSet<>();
int numTerms;
if (random().nextInt(10) == 7) {
@@ -422,7 +422,7 @@ public abstract class BasePostingsFormat
}
}
- allTerms = new ArrayList<FieldAndTerm>();
+ allTerms = new ArrayList<>();
for(Map.Entry<String,SortedMap<BytesRef,Long>> fieldEnt : fields.entrySet()) {
String field = fieldEnt.getKey();
for(Map.Entry<BytesRef,Long> termEnt : fieldEnt.getValue().entrySet()) {
@@ -1103,8 +1103,8 @@ public abstract class BasePostingsFormat
ThreadState threadState = new ThreadState();
// Test random terms/fields:
- List<TermState> termStates = new ArrayList<TermState>();
- List<FieldAndTerm> termStateTerms = new ArrayList<FieldAndTerm>();
+ List<TermState> termStates = new ArrayList<>();
+ List<FieldAndTerm> termStateTerms = new ArrayList<>();
Collections.shuffle(allTerms, random());
int upto = 0;
@@ -1387,7 +1387,7 @@ public abstract class BasePostingsFormat
// while up to one thread flushes, and each of those
// threads iterates over the map while the flushing
// thread might be adding to it:
- final Map<String,TermFreqs> termFreqs = new ConcurrentHashMap<String,TermFreqs>();
+ final Map<String,TermFreqs> termFreqs = new ConcurrentHashMap<>();
final AtomicLong sumDocFreq = new AtomicLong();
final AtomicLong sumTotalTermFreq = new AtomicLong();
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java Wed Mar 12 14:39:17 2014
@@ -99,7 +99,7 @@ public abstract class BaseStoredFieldsFo
final int docCount = atLeast(200);
final int fieldCount = TestUtil.nextInt(rand, 1, 5);
- final List<Integer> fieldIDs = new ArrayList<Integer>();
+ final List<Integer> fieldIDs = new ArrayList<>();
FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
@@ -109,7 +109,7 @@ public abstract class BaseStoredFieldsFo
fieldIDs.add(i);
}
- final Map<String,Document> docs = new HashMap<String,Document>();
+ final Map<String,Document> docs = new HashMap<>();
if (VERBOSE) {
System.out.println("TEST: build index docCount=" + docCount);
@@ -439,8 +439,8 @@ public abstract class BaseStoredFieldsFo
final IndexSearcher searcher = new IndexSearcher(rd);
final int concurrentReads = atLeast(5);
final int readsPerThread = atLeast(50);
- final List<Thread> readThreads = new ArrayList<Thread>();
- final AtomicReference<Exception> ex = new AtomicReference<Exception>();
+ final List<Thread> readThreads = new ArrayList<>();
+ final AtomicReference<Exception> ex = new AtomicReference<>();
for (int i = 0; i < concurrentReads; ++i) {
readThreads.add(new Thread() {
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java Wed Mar 12 14:39:17 2014
@@ -102,7 +102,7 @@ public abstract class BaseTermVectorsFor
}
protected Options randomOptions() {
- return RandomPicks.randomFrom(random(), new ArrayList<Options>(validOptions()));
+ return RandomPicks.randomFrom(random(), new ArrayList<>(validOptions()));
}
protected FieldType fieldType(Options options) {
@@ -245,8 +245,8 @@ public abstract class BaseTermVectorsFor
}
}
- positionToTerms = new HashMap<Integer, Set<Integer>>(len);
- startOffsetToTerms = new HashMap<Integer, Set<Integer>>(len);
+ positionToTerms = new HashMap<>(len);
+ startOffsetToTerms = new HashMap<>(len);
for (int i = 0; i < len; ++i) {
if (!positionToTerms.containsKey(positions[i])) {
positionToTerms.put(positions[i], new HashSet<Integer>(1));
@@ -258,7 +258,7 @@ public abstract class BaseTermVectorsFor
startOffsetToTerms.get(startOffsets[i]).add(i);
}
- freqs = new HashMap<String, Integer>();
+ freqs = new HashMap<>();
for (String term : terms) {
if (freqs.containsKey(term)) {
freqs.put(term, freqs.get(term) + 1);
@@ -314,7 +314,7 @@ public abstract class BaseTermVectorsFor
fieldTypes = new FieldType[fieldCount];
tokenStreams = new RandomTokenStream[fieldCount];
Arrays.fill(fieldTypes, fieldType(options));
- final Set<String> usedFileNames = new HashSet<String>();
+ final Set<String> usedFileNames = new HashSet<>();
for (int i = 0; i < fieldCount; ++i) {
do {
this.fieldNames[i] = RandomPicks.randomFrom(random(), fieldNames);
@@ -341,7 +341,7 @@ public abstract class BaseTermVectorsFor
private final BytesRef[] termBytes;
protected RandomDocumentFactory(int distinctFieldNames, int disctinctTerms) {
- final Set<String> fieldNames = new HashSet<String>();
+ final Set<String> fieldNames = new HashSet<>();
while (fieldNames.size() < distinctFieldNames) {
fieldNames.add(TestUtil.randomSimpleString(random()));
fieldNames.remove("id");
@@ -365,8 +365,8 @@ public abstract class BaseTermVectorsFor
// compare field names
assertEquals(doc == null, fields == null);
assertEquals(doc.fieldNames.length, fields.size());
- final Set<String> fields1 = new HashSet<String>();
- final Set<String> fields2 = new HashSet<String>();
+ final Set<String> fields1 = new HashSet<>();
+ final Set<String> fields2 = new HashSet<>();
for (int i = 0; i < doc.fieldNames.length; ++i) {
fields1.add(doc.fieldNames[i]);
}
@@ -389,19 +389,19 @@ public abstract class BaseTermVectorsFor
}
// to test reuse
- private final ThreadLocal<TermsEnum> termsEnum = new ThreadLocal<TermsEnum>();
- private final ThreadLocal<DocsEnum> docsEnum = new ThreadLocal<DocsEnum>();
- private final ThreadLocal<DocsAndPositionsEnum> docsAndPositionsEnum = new ThreadLocal<DocsAndPositionsEnum>();
+ private final ThreadLocal<TermsEnum> termsEnum = new ThreadLocal<>();
+ private final ThreadLocal<DocsEnum> docsEnum = new ThreadLocal<>();
+ private final ThreadLocal<DocsAndPositionsEnum> docsAndPositionsEnum = new ThreadLocal<>();
protected void assertEquals(RandomTokenStream tk, FieldType ft, Terms terms) throws IOException {
assertEquals(1, terms.getDocCount());
- final int termCount = new HashSet<String>(Arrays.asList(tk.terms)).size();
+ final int termCount = new HashSet<>(Arrays.asList(tk.terms)).size();
assertEquals(termCount, terms.size());
assertEquals(termCount, terms.getSumDocFreq());
assertEquals(ft.storeTermVectorPositions(), terms.hasPositions());
assertEquals(ft.storeTermVectorOffsets(), terms.hasOffsets());
assertEquals(ft.storeTermVectorPayloads() && tk.hasPayloads(), terms.hasPayloads());
- final Set<BytesRef> uniqueTerms = new HashSet<BytesRef>();
+ final Set<BytesRef> uniqueTerms = new HashSet<>();
for (String term : tk.freqs.keySet()) {
uniqueTerms.add(new BytesRef(term));
}
@@ -638,7 +638,7 @@ public abstract class BaseTermVectorsFor
final RandomDocumentFactory docFactory = new RandomDocumentFactory(5, 20);
final int numDocs = atLeast(100);
final int numDeletes = random().nextInt(numDocs);
- final Set<Integer> deletes = new HashSet<Integer>();
+ final Set<Integer> deletes = new HashSet<>();
while (deletes.size() < numDeletes) {
deletes.add(random().nextInt(numDocs));
}
@@ -694,7 +694,7 @@ public abstract class BaseTermVectorsFor
assertEquals(docs[i], reader.getTermVectors(docID));
}
- final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
+ final AtomicReference<Throwable> exception = new AtomicReference<>();
final Thread[] threads = new Thread[2];
for (int i = 0; i < threads.length; ++i) {
threads[i] = new Thread() {