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 19:14:27 UTC
svn commit: r1576837 [15/29] - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/analysis/
lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/
lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/
lucene/analysis/co...
Modified: lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletion.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletion.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletion.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletion.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionLookup.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/WFSTCompletionLookup.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java Wed Mar 12 18:14:05 2014
@@ -100,7 +100,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/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTLookup.java Wed Mar 12 18:14:05 2014
@@ -62,8 +62,8 @@ public class TSTLookup extends Lookup {
tfit = new SortedInputIterator(tfit, BytesRef.getUTF8SortedAsUTF16Comparator());
}
- 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 = tfit.next()) != null) {
@@ -120,7 +120,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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/spell/TestWordBreakSpellChecker.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentDictionaryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentDictionaryTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentDictionaryTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentDictionaryTest.java Wed Mar 12 18:14:05 2014
@@ -53,8 +53,8 @@ public class DocumentDictionaryTest exte
/** Returns Pair(list of invalid document terms, Map of document term -> document) */
private Map.Entry<List<String>, Map<String, Document>> generateIndexDocuments(int ndocs, boolean requiresPayload) {
- Map<String, Document> docs = new HashMap<String,Document>();
- List<String> invalidDocTerms = new ArrayList<String>();
+ Map<String, Document> docs = new HashMap<>();
+ List<String> invalidDocTerms = new ArrayList<>();
for(int i = 0; i < ndocs ; i++) {
Document doc = new Document();
boolean invalidDoc = false;
@@ -96,7 +96,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
@@ -201,7 +201,7 @@ public class DocumentDictionaryTest exte
Map<String, Document> docs = res.getValue();
List<String> invalidDocTerms = res.getKey();
Random rand = random();
- List<String> termsToDel = new ArrayList<String>();
+ List<String> termsToDel = new ArrayList<>();
for(Document doc : docs.values()) {
IndexableField f = doc.getField(FIELD_NAME);
if(rand.nextBoolean() && f != null && !invalidDocTerms.contains(f.stringValue())) {
Modified: lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentValueSourceDictionaryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentValueSourceDictionaryTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentValueSourceDictionaryTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/DocumentValueSourceDictionaryTest.java Wed Mar 12 18:14:05 2014
@@ -56,7 +56,7 @@ public class DocumentValueSourceDictiona
static final String PAYLOAD_FIELD_NAME = "p1";
private Map<String, Document> generateIndexDocuments(int ndocs) {
- Map<String, Document> docs = new HashMap<String, Document>();
+ Map<String, Document> docs = new HashMap<>();
for(int i = 0; i < ndocs ; i++) {
Field field = new TextField(FIELD_NAME, "field_" + i, Field.Store.YES);
Field payload = new StoredField(PAYLOAD_FIELD_NAME, new BytesRef("payload_" + i));
@@ -167,7 +167,7 @@ public class DocumentValueSourceDictiona
RandomIndexWriter writer = new RandomIndexWriter(random(), dir, iwc);
Map<String, Document> docs = generateIndexDocuments(atLeast(100));
Random rand = random();
- List<String> termsToDel = new ArrayList<String>();
+ List<String> termsToDel = new ArrayList<>();
for(Document doc : docs.values()) {
if(rand.nextBoolean() && termsToDel.size() < docs.size()-1) {
termsToDel.add(doc.get(FIELD_NAME));
Modified: lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java Wed Mar 12 18:14:05 2014
@@ -35,7 +35,7 @@ import org.junit.Test;
public class FileDictionaryTest extends LuceneTestCase {
private Map.Entry<List<String>, String> generateFileEntry(String fieldDelimiter, boolean hasWeight, boolean hasPayload) {
- List<String> entryValues = new ArrayList<String>();
+ List<String> entryValues = new ArrayList<>();
StringBuilder sb = new StringBuilder();
String term = TestUtil.randomSimpleString(random(), 1, 300);
sb.append(term);
@@ -53,11 +53,11 @@ 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) {
- List<List<String>> entries = new ArrayList<List<String>>();
+ List<List<String>> entries = new ArrayList<>();
StringBuilder sb = new StringBuilder();
boolean hasPayload = hasPayloads;
for (int i = 0; i < count; i++) {
@@ -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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/TestInputIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/TestInputIterator.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/TestInputIterator.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/TestInputIterator.java Wed Mar 12 18:14:05 2014
@@ -43,8 +43,8 @@ public class TestInputIterator extends L
int num = atLeast(10000);
Comparator<BytesRef> comparator = random.nextBoolean() ? BytesRef.getUTF8SortedAsUnicodeComparator() : BytesRef.getUTF8SortedAsUTF16Comparator();
- TreeMap<BytesRef, SimpleEntry<Long, BytesRef>> sorted = new TreeMap<BytesRef,SimpleEntry<Long,BytesRef>>(comparator);
- TreeMap<BytesRef, Long> sortedWithoutPayload = new TreeMap<BytesRef,Long>(comparator);
+ TreeMap<BytesRef, SimpleEntry<Long, BytesRef>> sorted = new TreeMap<>(comparator);
+ TreeMap<BytesRef, Long> sortedWithoutPayload = new TreeMap<>(comparator);
Input[] unsorted = new Input[num];
Input[] unsortedWithoutPayload = new Input[num];
@@ -57,7 +57,7 @@ public class TestInputIterator extends L
} while (sorted.containsKey(key));
long value = random.nextLong();
sortedWithoutPayload.put(key, value);
- sorted.put(key, new SimpleEntry<Long,BytesRef>(value, payload));
+ sorted.put(key, new SimpleEntry<>(value, payload));
unsorted[i] = new Input(key, value, payload);
unsortedWithoutPayload[i] = new Input(key, value);
}
@@ -76,12 +76,12 @@ public class TestInputIterator extends L
// test the unsorted iterator wrapper with payloads
wrapper = new UnsortedInputIterator(new InputArrayIterator(unsorted));
- TreeMap<BytesRef, SimpleEntry<Long, BytesRef>> actual = new TreeMap<BytesRef,SimpleEntry<Long,BytesRef>>();
+ TreeMap<BytesRef, SimpleEntry<Long, BytesRef>> actual = new TreeMap<>();
BytesRef key;
while ((key = wrapper.next()) != null) {
long value = wrapper.weight();
BytesRef payload = wrapper.payload();
- actual.put(BytesRef.deepCopyOf(key), new SimpleEntry<Long,BytesRef>(value, BytesRef.deepCopyOf(payload)));
+ actual.put(BytesRef.deepCopyOf(key), new SimpleEntry<>(value, BytesRef.deepCopyOf(payload)));
}
assertEquals(sorted, actual);
@@ -99,7 +99,7 @@ public class TestInputIterator extends L
// test the unsorted iterator wrapper without payloads
wrapperWithoutPayload = new UnsortedInputIterator(new InputArrayIterator(unsortedWithoutPayload));
- TreeMap<BytesRef, Long> actualWithoutPayload = new TreeMap<BytesRef,Long>();
+ TreeMap<BytesRef, Long> actualWithoutPayload = new TreeMap<>();
while ((key = wrapperWithoutPayload.next()) != null) {
long value = wrapperWithoutPayload.weight();
assertNull(wrapperWithoutPayload.payload());
Modified: lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggesterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggesterTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggesterTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggesterTest.java Wed Mar 12 18:14:05 2014
@@ -151,7 +151,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();
@@ -497,11 +497,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;
@@ -595,7 +595,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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java Wed Mar 12 18:14:05 2014
@@ -160,8 +160,8 @@ public class AnalyzingSuggesterTest exte
public void testRandomRealisticKeys() throws IOException {
LineFileDocs lineFile = new LineFileDocs(random());
- Map<String, Long> mapping = new HashMap<String, Long>();
- List<Input> keys = new ArrayList<Input>();
+ Map<String, Long> mapping = new HashMap<>();
+ List<Input> keys = new ArrayList<>();
int howMany = atLeast(100); // this might bring up duplicates
for (int i = 0; i < howMany; i++) {
@@ -177,7 +177,7 @@ public class AnalyzingSuggesterTest exte
AnalyzingSuggester.EXACT_FIRST | AnalyzingSuggester.PRESERVE_SEP, 256, -1, random().nextBoolean());
boolean doPayloads = random().nextBoolean();
if (doPayloads) {
- List<Input> keysAndPayloads = new ArrayList<Input>();
+ List<Input> keysAndPayloads = new ArrayList<>();
for (Input termFreq : keys) {
keysAndPayloads.add(new Input(termFreq.term, termFreq.v, new BytesRef(Long.toString(termFreq.v))));
}
@@ -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(" ");
@@ -1193,7 +1193,7 @@ public class AnalyzingSuggesterTest exte
}
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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/TestFreeTextSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/TestFreeTextSuggester.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/TestFreeTextSuggester.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/TestFreeTextSuggester.java Wed Mar 12 18:14:05 2014
@@ -301,7 +301,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)) {
@@ -380,12 +380,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++) {
@@ -442,9 +442,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");
@@ -507,7 +507,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) {
@@ -599,7 +599,7 @@ public class TestFreeTextSuggester exten
}
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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java Wed Mar 12 18:14:05 2014
@@ -270,7 +270,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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/LookaheadTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/LookaheadTokenFilter.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/LookaheadTokenFilter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/LookaheadTokenFilter.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockCharFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockCharFilter.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockCharFilter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockCharFilter.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/ValidatingTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/ValidatingTokenFilter.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/ValidatingTokenFilter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/ValidatingTokenFilter.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene40/Lucene40DocValuesWriter.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/lucene42/Lucene42DocValuesConsumer.java Wed Mar 12 18:14:05 2014
@@ -98,7 +98,7 @@ class Lucene42DocValuesConsumer extends
// TODO: more efficient?
HashSet<Long> uniqueValues = null;
if (optimizeStorage) {
- uniqueValues = new HashSet<Long>();
+ uniqueValues = new HashSet<>();
long count = 0;
for (Number nv : values) {
@@ -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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/mockrandom/MockRandomPostingsFormat.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java Wed Mar 12 18:14:05 2014
@@ -101,7 +101,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) {
@@ -134,7 +134,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;
@@ -208,7 +208,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;
}
@@ -558,7 +558,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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java Wed Mar 12 18:14:05 2014
@@ -328,7 +328,7 @@ public abstract class BasePostingsFormat
public static void createPostings() throws IOException {
totalPostings = 0;
totalPayloadBytes = 0;
- fields = new TreeMap<String,Map<BytesRef,Long>>();
+ fields = new TreeMap<>();
final int numFields = TestUtil.nextInt(random(), 1, 5);
if (VERBOSE) {
@@ -349,9 +349,9 @@ public abstract class BasePostingsFormat
null, DocValuesType.NUMERIC, null);
fieldUpto++;
- Map<BytesRef,Long> postings = new TreeMap<BytesRef,Long>();
+ Map<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) {
@@ -409,7 +409,7 @@ public abstract class BasePostingsFormat
}
}
- allTerms = new ArrayList<FieldAndTerm>();
+ allTerms = new ArrayList<>();
for(Map.Entry<String,Map<BytesRef,Long>> fieldEnt : fields.entrySet()) {
String field = fieldEnt.getKey();
for(Map.Entry<BytesRef,Long> termEnt : fieldEnt.getValue().entrySet()) {
@@ -956,8 +956,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;
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java Wed Mar 12 18:14:05 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/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java Wed Mar 12 18:14:05 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() {
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java Wed Mar 12 18:14:05 2014
@@ -175,16 +175,16 @@ class DocHelper {
largeLazyField//placeholder for large field, since this is null. It must always be last
};
- public static Map<String,IndexableField> all =new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> indexed =new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> stored =new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> unstored=new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> unindexed=new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> termvector=new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> notermvector=new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> lazy= new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> noNorms=new HashMap<String,IndexableField>();
- public static Map<String,IndexableField> noTf=new HashMap<String,IndexableField>();
+ public static Map<String,IndexableField> all =new HashMap<>();
+ public static Map<String,IndexableField> indexed =new HashMap<>();
+ public static Map<String,IndexableField> stored =new HashMap<>();
+ public static Map<String,IndexableField> unstored=new HashMap<>();
+ public static Map<String,IndexableField> unindexed=new HashMap<>();
+ public static Map<String,IndexableField> termvector=new HashMap<>();
+ public static Map<String,IndexableField> notermvector=new HashMap<>();
+ public static Map<String,IndexableField> lazy= new HashMap<>();
+ public static Map<String,IndexableField> noNorms=new HashMap<>();
+ public static Map<String,IndexableField> noTf=new HashMap<>();
static {
//Initialize the large Lazy Field
@@ -227,7 +227,7 @@ class DocHelper {
static
{
- nameValues = new HashMap<String,Object>();
+ nameValues = new HashMap<>();
nameValues.put(TEXT_FIELD_1_KEY, FIELD_1_TEXT);
nameValues.put(TEXT_FIELD_2_KEY, FIELD_2_TEXT);
nameValues.put(TEXT_FIELD_3_KEY, FIELD_3_TEXT);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/FieldFilterAtomicReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/FieldFilterAtomicReader.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/FieldFilterAtomicReader.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/FieldFilterAtomicReader.java Wed Mar 12 18:14:05 2014
@@ -39,7 +39,7 @@ public final class FieldFilterAtomicRead
super(in);
this.fields = fields;
this.negate = negate;
- ArrayList<FieldInfo> filteredInfos = new ArrayList<FieldInfo>();
+ ArrayList<FieldInfo> filteredInfos = new ArrayList<>();
for (FieldInfo fi : in.getFieldInfos()) {
if (hasField(fi.name)) {
filteredInfos.add(fi);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java Wed Mar 12 18:14:05 2014
@@ -46,7 +46,7 @@ public class MockRandomMergePolicy exten
int numSegments = segmentInfos.size();
- List<SegmentCommitInfo> segments = new ArrayList<SegmentCommitInfo>();
+ List<SegmentCommitInfo> segments = new ArrayList<>();
final Collection<SegmentCommitInfo> merging = writer.get().getMergingSegments();
for(SegmentCommitInfo sipc : segmentInfos) {
@@ -75,7 +75,7 @@ public class MockRandomMergePolicy exten
SegmentInfos segmentInfos, int maxSegmentCount, Map<SegmentCommitInfo,Boolean> segmentsToMerge)
throws IOException {
- final List<SegmentCommitInfo> eligibleSegments = new ArrayList<SegmentCommitInfo>();
+ final List<SegmentCommitInfo> eligibleSegments = new ArrayList<>();
for(SegmentCommitInfo info : segmentInfos) {
if (segmentsToMerge.containsKey(info)) {
eligibleSegments.add(info);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java Wed Mar 12 18:14:05 2014
@@ -66,16 +66,16 @@ import org.apache.lucene.util.TestUtil;
*/
public class RandomCodec extends Lucene46Codec {
/** Shuffled list of postings formats to use for new mappings */
- private List<PostingsFormat> formats = new ArrayList<PostingsFormat>();
+ private List<PostingsFormat> formats = new ArrayList<>();
/** Shuffled list of docvalues formats to use for new mappings */
- private List<DocValuesFormat> dvFormats = new ArrayList<DocValuesFormat>();
+ private List<DocValuesFormat> dvFormats = new ArrayList<>();
/** unique set of format names this codec knows about */
- public Set<String> formatNames = new HashSet<String>();
+ public Set<String> formatNames = new HashSet<>();
/** unique set of docvalues format names this codec knows about */
- public Set<String> dvFormatNames = new HashSet<String>();
+ public Set<String> dvFormatNames = new HashSet<>();
/** memorized field->postingsformat mappings */
// note: we have to sync this map even though its just for debugging/toString,
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java Wed Mar 12 18:14:05 2014
@@ -125,8 +125,8 @@ public abstract class ThreadedIndexingAn
@Override
public void run() {
// TODO: would be better if this were cross thread, so that we make sure one thread deleting anothers added docs works:
- final List<String> toDeleteIDs = new ArrayList<String>();
- final List<SubDocs> toDeleteSubDocs = new ArrayList<SubDocs>();
+ final List<String> toDeleteIDs = new ArrayList<>();
+ final List<SubDocs> toDeleteSubDocs = new ArrayList<>();
while(System.currentTimeMillis() < stopTime && !failed.get()) {
try {
@@ -180,9 +180,9 @@ public abstract class ThreadedIndexingAn
}
final Field packIDField = newStringField("packID", packID, Field.Store.YES);
- final List<String> docIDs = new ArrayList<String>();
+ final List<String> docIDs = new ArrayList<>();
final SubDocs subDocs = new SubDocs(packID, docIDs);
- final List<Document> docsList = new ArrayList<Document>();
+ final List<Document> docsList = new ArrayList<>();
allSubDocs.add(subDocs);
doc.add(packIDField);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingBulkScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingBulkScorer.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingBulkScorer.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingBulkScorer.java Wed Mar 12 18:14:05 2014
@@ -31,8 +31,8 @@ import org.apache.lucene.util.VirtualMet
/** Wraps a Scorer with additional checks */
public class AssertingBulkScorer extends BulkScorer {
- private static final VirtualMethod<BulkScorer> SCORE_COLLECTOR = new VirtualMethod<BulkScorer>(BulkScorer.class, "score", Collector.class);
- private static final VirtualMethod<BulkScorer> SCORE_COLLECTOR_RANGE = new VirtualMethod<BulkScorer>(BulkScorer.class, "score", Collector.class, int.class);
+ private static final VirtualMethod<BulkScorer> SCORE_COLLECTOR = new VirtualMethod<>(BulkScorer.class, "score", Collector.class);
+ private static final VirtualMethod<BulkScorer> SCORE_COLLECTOR_RANGE = new VirtualMethod<>(BulkScorer.class, "score", Collector.class, int.class);
public static BulkScorer wrap(Random random, BulkScorer other) {
if (other == null || other instanceof AssertingBulkScorer) {
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java Wed Mar 12 18:14:05 2014
@@ -40,7 +40,7 @@ public class AssertingScorer extends Sco
return other;
}
final AssertingScorer assertScorer = new AssertingScorer(random, other);
- ASSERTING_INSTANCES.put(other, new WeakReference<AssertingScorer>(assertScorer));
+ ASSERTING_INSTANCES.put(other, new WeakReference<>(assertScorer));
return assertScorer;
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java Wed Mar 12 18:14:05 2014
@@ -59,7 +59,7 @@ public class CheckHits {
throws IOException {
String d = q.toString(defaultFieldName);
- Set<Integer> ignore = new TreeSet<Integer>();
+ Set<Integer> ignore = new TreeSet<>();
for (int i = 0; i < results.length; i++) {
ignore.add(Integer.valueOf(results[i]));
}
@@ -98,11 +98,11 @@ public class CheckHits {
QueryUtils.check(random,query,searcher);
- Set<Integer> correct = new TreeSet<Integer>();
+ Set<Integer> correct = new TreeSet<>();
for (int i = 0; i < results.length; i++) {
correct.add(Integer.valueOf(results[i]));
}
- final Set<Integer> actual = new TreeSet<Integer>();
+ final Set<Integer> actual = new TreeSet<>();
final Collector c = new SetCollector(actual);
searcher.search(query, c);
@@ -168,12 +168,12 @@ public class CheckHits {
ScoreDoc[] hits = searcher.search(query, 1000).scoreDocs;
- Set<Integer> correct = new TreeSet<Integer>();
+ Set<Integer> correct = new TreeSet<>();
for (int i = 0; i < results.length; i++) {
correct.add(Integer.valueOf(results[i]));
}
- Set<Integer> actual = new TreeSet<Integer>();
+ Set<Integer> actual = new TreeSet<>();
for (int i = 0; i < hits.length; i++) {
actual.add(Integer.valueOf(hits[i].doc));
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/RandomSimilarityProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/RandomSimilarityProvider.java?rev=1576837&r1=1576836&r2=1576837&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/RandomSimilarityProvider.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/RandomSimilarityProvider.java Wed Mar 12 18:14:05 2014
@@ -65,7 +65,7 @@ import org.apache.lucene.search.similari
public class RandomSimilarityProvider extends PerFieldSimilarityWrapper {
final DefaultSimilarity defaultSim = new DefaultSimilarity();
final List<Similarity> knownSims;
- Map<String,Similarity> previousMappings = new HashMap<String,Similarity>();
+ Map<String,Similarity> previousMappings = new HashMap<>();
final int perFieldSeed;
final int coordType; // 0 = no coord, 1 = coord, 2 = crazy coord
final boolean shouldQueryNorm;
@@ -74,7 +74,7 @@ public class RandomSimilarityProvider ex
perFieldSeed = random.nextInt();
coordType = random.nextInt(3);
shouldQueryNorm = random.nextBoolean();
- knownSims = new ArrayList<Similarity>(allSims);
+ knownSims = new ArrayList<>(allSims);
Collections.shuffle(knownSims, random);
}
@@ -138,7 +138,7 @@ public class RandomSimilarityProvider ex
};
static List<Similarity> allSims;
static {
- allSims = new ArrayList<Similarity>();
+ allSims = new ArrayList<>();
allSims.add(new DefaultSimilarity());
allSims.add(new BM25Similarity());
for (BasicModel basicModel : BASIC_MODELS) {