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 [7/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/an...
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/FieldCacheSanityChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/FieldCacheSanityChecker.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/FieldCacheSanityChecker.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/FieldCacheSanityChecker.java Wed Mar 12 14:39:17 2014
@@ -109,13 +109,13 @@ public final class FieldCacheSanityCheck
//
// maps the (valId) identityhashCode of cache values to
// sets of CacheEntry instances
- final MapOfSets<Integer, CacheEntry> valIdToItems = new MapOfSets<Integer, CacheEntry>(new HashMap<Integer, Set<CacheEntry>>(17));
+ final MapOfSets<Integer, CacheEntry> valIdToItems = new MapOfSets<>(new HashMap<Integer, Set<CacheEntry>>(17));
// maps ReaderField keys to Sets of ValueIds
- final MapOfSets<ReaderField, Integer> readerFieldToValIds = new MapOfSets<ReaderField, Integer>(new HashMap<ReaderField, Set<Integer>>(17));
+ final MapOfSets<ReaderField, Integer> readerFieldToValIds = new MapOfSets<>(new HashMap<ReaderField, Set<Integer>>(17));
//
// any keys that we know result in more then one valId
- final Set<ReaderField> valMismatchKeys = new HashSet<ReaderField>();
+ final Set<ReaderField> valMismatchKeys = new HashSet<>();
// iterate over all the cacheEntries to get the mappings we'll need
for (int i = 0; i < cacheEntries.length; i++) {
@@ -144,7 +144,7 @@ public final class FieldCacheSanityCheck
}
}
- final List<Insanity> insanity = new ArrayList<Insanity>(valMismatchKeys.size() * 3);
+ final List<Insanity> insanity = new ArrayList<>(valMismatchKeys.size() * 3);
insanity.addAll(checkValueMismatch(valIdToItems,
readerFieldToValIds,
@@ -166,7 +166,7 @@ public final class FieldCacheSanityCheck
MapOfSets<ReaderField, Integer> readerFieldToValIds,
Set<ReaderField> valMismatchKeys) {
- final List<Insanity> insanity = new ArrayList<Insanity>(valMismatchKeys.size() * 3);
+ final List<Insanity> insanity = new ArrayList<>(valMismatchKeys.size() * 3);
if (! valMismatchKeys.isEmpty() ) {
// we have multiple values for some ReaderFields
@@ -174,7 +174,7 @@ public final class FieldCacheSanityCheck
final Map<ReaderField, Set<Integer>> rfMap = readerFieldToValIds.getMap();
final Map<Integer, Set<CacheEntry>> valMap = valIdToItems.getMap();
for (final ReaderField rf : valMismatchKeys) {
- final List<CacheEntry> badEntries = new ArrayList<CacheEntry>(valMismatchKeys.size() * 2);
+ final List<CacheEntry> badEntries = new ArrayList<>(valMismatchKeys.size() * 2);
for(final Integer value: rfMap.get(rf)) {
for (final CacheEntry cacheEntry : valMap.get(value)) {
badEntries.add(cacheEntry);
@@ -203,15 +203,15 @@ public final class FieldCacheSanityCheck
private Collection<Insanity> checkSubreaders( MapOfSets<Integer, CacheEntry> valIdToItems,
MapOfSets<ReaderField, Integer> readerFieldToValIds) {
- final List<Insanity> insanity = new ArrayList<Insanity>(23);
+ final List<Insanity> insanity = new ArrayList<>(23);
- Map<ReaderField, Set<ReaderField>> badChildren = new HashMap<ReaderField, Set<ReaderField>>(17);
- MapOfSets<ReaderField, ReaderField> badKids = new MapOfSets<ReaderField, ReaderField>(badChildren); // wrapper
+ Map<ReaderField, Set<ReaderField>> badChildren = new HashMap<>(17);
+ MapOfSets<ReaderField, ReaderField> badKids = new MapOfSets<>(badChildren); // wrapper
Map<Integer, Set<CacheEntry>> viToItemSets = valIdToItems.getMap();
Map<ReaderField, Set<Integer>> rfToValIdSets = readerFieldToValIds.getMap();
- Set<ReaderField> seen = new HashSet<ReaderField>(17);
+ Set<ReaderField> seen = new HashSet<>(17);
Set<ReaderField> readerFields = rfToValIdSets.keySet();
for (final ReaderField rf : readerFields) {
@@ -242,7 +242,7 @@ public final class FieldCacheSanityCheck
for (final ReaderField parent : badChildren.keySet()) {
Set<ReaderField> kids = badChildren.get(parent);
- List<CacheEntry> badEntries = new ArrayList<CacheEntry>(kids.size() * 2);
+ List<CacheEntry> badEntries = new ArrayList<>(kids.size() * 2);
// put parent entr(ies) in first
{
@@ -277,7 +277,7 @@ public final class FieldCacheSanityCheck
* returned by {@code seed.getCoreCacheKey()}
*/
private List<Object> getAllDescendantReaderKeys(Object seed) {
- List<Object> all = new ArrayList<Object>(17); // will grow as we iter
+ List<Object> all = new ArrayList<>(17); // will grow as we iter
all.add(seed);
for (int i = 0; i < all.size(); i++) {
final Object obj = all.get(i);
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/MapOfSets.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/MapOfSets.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/MapOfSets.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/MapOfSets.java Wed Mar 12 14:39:17 2014
@@ -55,7 +55,7 @@ public class MapOfSets<K, V> {
if (theMap.containsKey(key)) {
theSet = theMap.get(key);
} else {
- theSet = new HashSet<V>(23);
+ theSet = new HashSet<>(23);
theMap.put(key, theSet);
}
theSet.add(val);
@@ -72,7 +72,7 @@ public class MapOfSets<K, V> {
if (theMap.containsKey(key)) {
theSet = theMap.get(key);
} else {
- theSet = new HashSet<V>(23);
+ theSet = new HashSet<>(23);
theMap.put(key, theSet);
}
theSet.addAll(vals);
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/MergedIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/MergedIterator.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/MergedIterator.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/MergedIterator.java Wed Mar 12 14:39:17 2014
@@ -59,12 +59,12 @@ public final class MergedIterator<T exte
@SuppressWarnings({"unchecked","rawtypes"})
public MergedIterator(boolean removeDuplicates, Iterator<T>... iterators) {
this.removeDuplicates = removeDuplicates;
- queue = new TermMergeQueue<T>(iterators.length);
+ queue = new TermMergeQueue<>(iterators.length);
top = new SubIterator[iterators.length];
int index = 0;
for (Iterator<T> iterator : iterators) {
if (iterator.hasNext()) {
- SubIterator<T> sub = new SubIterator<T>();
+ SubIterator<T> sub = new SubIterator<>();
sub.current = iterator.next();
sub.iterator = iterator;
sub.index = index++;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/NamedSPILoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/NamedSPILoader.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/NamedSPILoader.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/NamedSPILoader.java Wed Mar 12 14:39:17 2014
@@ -59,7 +59,7 @@ public final class NamedSPILoader<S exte
* of new service providers on the given classpath/classloader!</em>
*/
public synchronized void reload(ClassLoader classloader) {
- final LinkedHashMap<String,S> services = new LinkedHashMap<String,S>(this.services);
+ final LinkedHashMap<String,S> services = new LinkedHashMap<>(this.services);
final SPIClassIterator<S> loader = SPIClassIterator.get(clazz, classloader);
while (loader.hasNext()) {
final Class<? extends S> c = loader.next();
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/OfflineSorter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/OfflineSorter.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/OfflineSorter.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/OfflineSorter.java Wed Mar 12 14:39:17 2014
@@ -225,7 +225,7 @@ public final class OfflineSorter {
output.delete();
- ArrayList<File> merges = new ArrayList<File>();
+ ArrayList<File> merges = new ArrayList<>();
boolean success2 = false;
try {
ByteSequencesReader is = new ByteSequencesReader(input);
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java Wed Mar 12 14:39:17 2014
@@ -35,9 +35,9 @@ import org.apache.lucene.store.IndexInpu
// TODO: refactor this, byteblockpool, fst.bytestore, and any
// other "shift/mask big arrays". there are too many of these classes!
public final class PagedBytes {
- private final List<byte[]> blocks = new ArrayList<byte[]>();
+ private final List<byte[]> blocks = new ArrayList<>();
// TODO: these are unused?
- private final List<Integer> blockEnd = new ArrayList<Integer>();
+ private final List<Integer> blockEnd = new ArrayList<>();
private final int blockSize;
private final int blockBits;
private final int blockMask;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/QueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/QueryBuilder.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/QueryBuilder.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/QueryBuilder.java Wed Mar 12 14:39:17 2014
@@ -305,7 +305,7 @@ public class QueryBuilder {
// phrase query:
MultiPhraseQuery mpq = newMultiPhraseQuery();
mpq.setSlop(phraseSlop);
- List<Term> multiTerms = new ArrayList<Term>();
+ List<Term> multiTerms = new ArrayList<>();
int position = -1;
for (int i = 0; i < numTokens; i++) {
int positionIncrement = 1;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java Wed Mar 12 14:39:17 2014
@@ -105,7 +105,7 @@ public final class RamUsageEstimator {
*/
private static final Map<Class<?>,Integer> primitiveSizes;
static {
- primitiveSizes = new IdentityHashMap<Class<?>,Integer>();
+ primitiveSizes = new IdentityHashMap<>();
primitiveSizes.put(boolean.class, Integer.valueOf(NUM_BYTES_BOOLEAN));
primitiveSizes.put(byte.class, Integer.valueOf(NUM_BYTES_BYTE));
primitiveSizes.put(char.class, Integer.valueOf(NUM_BYTES_CHAR));
@@ -403,11 +403,11 @@ public final class RamUsageEstimator {
*/
private static long measureObjectSize(Object root) {
// Objects seen so far.
- final IdentityHashSet<Object> seen = new IdentityHashSet<Object>();
+ final IdentityHashSet<Object> seen = new IdentityHashSet<>();
// Class cache with reference Field and precalculated shallow size.
- final IdentityHashMap<Class<?>, ClassCache> classCache = new IdentityHashMap<Class<?>, ClassCache>();
+ final IdentityHashMap<Class<?>, ClassCache> classCache = new IdentityHashMap<>();
// Stack of objects pending traversal. Recursion caused stack overflows.
- final ArrayList<Object> stack = new ArrayList<Object>();
+ final ArrayList<Object> stack = new ArrayList<>();
stack.add(root);
long totalSize = 0;
@@ -486,7 +486,7 @@ public final class RamUsageEstimator {
private static ClassCache createCacheEntry(final Class<?> clazz) {
ClassCache cachedInfo;
long shallowInstanceSize = NUM_BYTES_OBJECT_HEADER;
- final ArrayList<Field> referenceFields = new ArrayList<Field>(32);
+ final ArrayList<Field> referenceFields = new ArrayList<>(32);
for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
final Field[] fields = c.getDeclaredFields();
for (final Field f : fields) {
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/SPIClassIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/SPIClassIterator.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/SPIClassIterator.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/SPIClassIterator.java Wed Mar 12 14:39:17 2014
@@ -47,11 +47,11 @@ public final class SPIClassIterator<S> i
private Iterator<String> linesIterator;
public static <S> SPIClassIterator<S> get(Class<S> clazz) {
- return new SPIClassIterator<S>(clazz, Thread.currentThread().getContextClassLoader());
+ return new SPIClassIterator<>(clazz, Thread.currentThread().getContextClassLoader());
}
public static <S> SPIClassIterator<S> get(Class<S> clazz, ClassLoader loader) {
- return new SPIClassIterator<S>(clazz, loader);
+ return new SPIClassIterator<>(clazz, loader);
}
/** Utility method to check if some class loader is a (grand-)parent of or the same as another one.
@@ -84,7 +84,7 @@ public final class SPIClassIterator<S> i
if (lines != null) {
lines.clear();
} else {
- lines = new ArrayList<String>();
+ lines = new ArrayList<>();
}
final URL url = profilesEnum.nextElement();
try {
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/SetOnce.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/SetOnce.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/SetOnce.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/SetOnce.java Wed Mar 12 14:39:17 2014
@@ -77,7 +77,7 @@ public final class SetOnce<T> implements
@Override
public SetOnce<T> clone() {
- return obj == null ? new SetOnce<T>() : new SetOnce<T>(obj);
+ return obj == null ? new SetOnce<T>() : new SetOnce<>(obj);
}
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java Wed Mar 12 14:39:17 2014
@@ -62,7 +62,7 @@ import java.util.concurrent.ConcurrentHa
* @lucene.internal
*/
public final class WeakIdentityMap<K,V> {
- private final ReferenceQueue<Object> queue = new ReferenceQueue<Object>();
+ private final ReferenceQueue<Object> queue = new ReferenceQueue<>();
private final Map<IdentityWeakReference, V> backingStore;
private final boolean reapOnRead;
@@ -80,7 +80,7 @@ public final class WeakIdentityMap<K,V>
* @param reapOnRead controls if the map <a href="#reapInfo">cleans up the reference queue on every read operation</a>.
*/
public static <K,V> WeakIdentityMap<K,V> newHashMap(boolean reapOnRead) {
- return new WeakIdentityMap<K,V>(new HashMap<IdentityWeakReference,V>(), reapOnRead);
+ return new WeakIdentityMap<>(new HashMap<IdentityWeakReference,V>(), reapOnRead);
}
/**
@@ -96,7 +96,7 @@ public final class WeakIdentityMap<K,V>
* @param reapOnRead controls if the map <a href="#reapInfo">cleans up the reference queue on every read operation</a>.
*/
public static <K,V> WeakIdentityMap<K,V> newConcurrentHashMap(boolean reapOnRead) {
- return new WeakIdentityMap<K,V>(new ConcurrentHashMap<IdentityWeakReference,V>(), reapOnRead);
+ return new WeakIdentityMap<>(new ConcurrentHashMap<IdentityWeakReference,V>(), reapOnRead);
}
/** Private only constructor, to create use the static factory methods. */
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java Wed Mar 12 14:39:17 2014
@@ -269,8 +269,8 @@ public class Automaton implements Clonea
public State[] getNumberedStates() {
if (numberedStates == null) {
expandSingleton();
- final Set<State> visited = new HashSet<State>();
- final LinkedList<State> worklist = new LinkedList<State>();
+ final Set<State> visited = new HashSet<>();
+ final LinkedList<State> worklist = new LinkedList<>();
numberedStates = new State[4];
int upto = 0;
worklist.add(initial);
@@ -333,9 +333,9 @@ public class Automaton implements Clonea
*/
public Set<State> getAcceptStates() {
expandSingleton();
- HashSet<State> accepts = new HashSet<State>();
- HashSet<State> visited = new HashSet<State>();
- LinkedList<State> worklist = new LinkedList<State>();
+ HashSet<State> accepts = new HashSet<>();
+ HashSet<State> visited = new HashSet<>();
+ LinkedList<State> worklist = new LinkedList<>();
worklist.add(initial);
visited.add(initial);
while (worklist.size() > 0) {
@@ -399,7 +399,7 @@ public class Automaton implements Clonea
*/
int[] getStartPoints() {
final State[] states = getNumberedStates();
- Set<Integer> pointset = new HashSet<Integer>();
+ Set<Integer> pointset = new HashSet<>();
pointset.add(Character.MIN_CODE_POINT);
for (State s : states) {
for (Transition t : s.getTransitions()) {
@@ -423,7 +423,7 @@ public class Automaton implements Clonea
*/
private State[] getLiveStates() {
final State[] states = getNumberedStates();
- Set<State> live = new HashSet<State>();
+ Set<State> live = new HashSet<>();
for (State q : states) {
if (q.isAccept()) {
live.add(q);
@@ -432,13 +432,13 @@ public class Automaton implements Clonea
// map<state, set<state>>
@SuppressWarnings({"rawtypes","unchecked"}) Set<State> map[] = new Set[states.length];
for (int i = 0; i < map.length; i++)
- map[i] = new HashSet<State>();
+ map[i] = new HashSet<>();
for (State s : states) {
for(int i=0;i<s.numTransitions;i++) {
map[s.transitionsArray[i].to.number].add(s);
}
}
- LinkedList<State> worklist = new LinkedList<State>(live);
+ LinkedList<State> worklist = new LinkedList<>(live);
while (worklist.size() > 0) {
State s = worklist.removeFirst();
for (State p : map[s.number])
@@ -639,7 +639,7 @@ public class Automaton implements Clonea
try {
Automaton a = (Automaton) super.clone();
if (!isSingleton()) {
- HashMap<State,State> m = new HashMap<State,State>();
+ HashMap<State,State> m = new HashMap<>();
State[] states = getNumberedStates();
for (State s : states)
m.put(s, new State());
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/BasicAutomata.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/BasicAutomata.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/BasicAutomata.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/BasicAutomata.java Wed Mar 12 14:39:17 2014
@@ -216,10 +216,10 @@ final public class BasicAutomata {
by.append('0');
by.append(y);
y = by.toString();
- Collection<State> initials = new ArrayList<State>();
+ Collection<State> initials = new ArrayList<>();
a.initial = between(x, y, 0, initials, digits <= 0);
if (digits <= 0) {
- ArrayList<StatePair> pairs = new ArrayList<StatePair>();
+ ArrayList<StatePair> pairs = new ArrayList<>();
for (State p : initials)
if (a.initial != p) pairs.add(new StatePair(a.initial, p));
BasicOperations.addEpsilons(a, pairs);
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/BasicOperations.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/BasicOperations.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/BasicOperations.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/BasicOperations.java Wed Mar 12 14:39:17 2014
@@ -106,7 +106,7 @@ final public class BasicOperations {
} else {
for (Automaton a : l)
if (BasicOperations.isEmpty(a)) return BasicAutomata.makeEmpty();
- Set<Integer> ids = new HashSet<Integer>();
+ Set<Integer> ids = new HashSet<>();
for (Automaton a : l)
ids.add(System.identityHashCode(a));
boolean has_aliases = ids.size() != l.size();
@@ -187,7 +187,7 @@ final public class BasicOperations {
*/
static public Automaton repeat(Automaton a, int min) {
if (min == 0) return repeat(a);
- List<Automaton> as = new ArrayList<Automaton>();
+ List<Automaton> as = new ArrayList<>();
while (min-- > 0)
as.add(a);
as.add(repeat(a));
@@ -210,7 +210,7 @@ final public class BasicOperations {
if (min == 0) b = BasicAutomata.makeEmptyString();
else if (min == 1) b = a.clone();
else {
- List<Automaton> as = new ArrayList<Automaton>();
+ List<Automaton> as = new ArrayList<>();
while (min-- > 0)
as.add(a);
b = concatenate(as);
@@ -287,8 +287,8 @@ final public class BasicOperations {
Transition[][] transitions1 = a1.getSortedTransitions();
Transition[][] transitions2 = a2.getSortedTransitions();
Automaton c = new Automaton();
- LinkedList<StatePair> worklist = new LinkedList<StatePair>();
- HashMap<StatePair,StatePair> newstates = new HashMap<StatePair,StatePair>();
+ LinkedList<StatePair> worklist = new LinkedList<>();
+ HashMap<StatePair,StatePair> newstates = new HashMap<>();
StatePair p = new StatePair(c.initial, a1.initial, a2.initial);
worklist.add(p);
newstates.put(p, p);
@@ -356,8 +356,8 @@ final public class BasicOperations {
a2.determinize();
Transition[][] transitions1 = a1.getSortedTransitions();
Transition[][] transitions2 = a2.getSortedTransitions();
- LinkedList<StatePair> worklist = new LinkedList<StatePair>();
- HashSet<StatePair> visited = new HashSet<StatePair>();
+ LinkedList<StatePair> worklist = new LinkedList<>();
+ HashSet<StatePair> visited = new HashSet<>();
StatePair p = new StatePair(a1.initial, a2.initial);
worklist.add(p);
visited.add(p);
@@ -431,7 +431,7 @@ final public class BasicOperations {
* Complexity: linear in number of states.
*/
public static Automaton union(Collection<Automaton> l) {
- Set<Integer> ids = new HashSet<Integer>();
+ Set<Integer> ids = new HashSet<>();
for (Automaton a : l)
ids.add(System.identityHashCode(a));
boolean has_aliases = ids.size() != l.size();
@@ -500,7 +500,7 @@ final public class BasicOperations {
PointTransitions[] points = new PointTransitions[5];
private final static int HASHMAP_CUTOVER = 30;
- private final HashMap<Integer,PointTransitions> map = new HashMap<Integer,PointTransitions>();
+ private final HashMap<Integer,PointTransitions> map = new HashMap<>();
private boolean useHash = false;
private PointTransitions next(int point) {
@@ -597,8 +597,8 @@ final public class BasicOperations {
a.initial = new State();
SortedIntSet.FrozenIntSet initialset = new SortedIntSet.FrozenIntSet(initNumber, a.initial);
- LinkedList<SortedIntSet.FrozenIntSet> worklist = new LinkedList<SortedIntSet.FrozenIntSet>();
- Map<SortedIntSet.FrozenIntSet,State> newstate = new HashMap<SortedIntSet.FrozenIntSet,State>();
+ LinkedList<SortedIntSet.FrozenIntSet> worklist = new LinkedList<>();
+ Map<SortedIntSet.FrozenIntSet,State> newstate = new HashMap<>();
worklist.add(initialset);
@@ -713,25 +713,25 @@ final public class BasicOperations {
*/
public static void addEpsilons(Automaton a, Collection<StatePair> pairs) {
a.expandSingleton();
- HashMap<State,HashSet<State>> forward = new HashMap<State,HashSet<State>>();
- HashMap<State,HashSet<State>> back = new HashMap<State,HashSet<State>>();
+ HashMap<State,HashSet<State>> forward = new HashMap<>();
+ HashMap<State,HashSet<State>> back = new HashMap<>();
for (StatePair p : pairs) {
HashSet<State> to = forward.get(p.s1);
if (to == null) {
- to = new HashSet<State>();
+ to = new HashSet<>();
forward.put(p.s1, to);
}
to.add(p.s2);
HashSet<State> from = back.get(p.s2);
if (from == null) {
- from = new HashSet<State>();
+ from = new HashSet<>();
back.put(p.s2, from);
}
from.add(p.s1);
}
// calculate epsilon closure
- LinkedList<StatePair> worklist = new LinkedList<StatePair>(pairs);
- HashSet<StatePair> workset = new HashSet<StatePair>(pairs);
+ LinkedList<StatePair> worklist = new LinkedList<>(pairs);
+ HashSet<StatePair> workset = new HashSet<>(pairs);
while (!worklist.isEmpty()) {
StatePair p = worklist.removeFirst();
workset.remove(p);
@@ -817,12 +817,12 @@ final public class BasicOperations {
return p.accept;
} else {
State[] states = a.getNumberedStates();
- LinkedList<State> pp = new LinkedList<State>();
- LinkedList<State> pp_other = new LinkedList<State>();
+ LinkedList<State> pp = new LinkedList<>();
+ LinkedList<State> pp_other = new LinkedList<>();
BitSet bb = new BitSet(states.length);
BitSet bb_other = new BitSet(states.length);
pp.add(a.initial);
- ArrayList<State> dest = new ArrayList<State>();
+ ArrayList<State> dest = new ArrayList<>();
boolean accept = a.initial.accept;
for (int i = 0, c = 0; i < s.length(); i += Character.charCount(c)) {
c = s.codePointAt(i);
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java Wed Mar 12 14:39:17 2014
@@ -272,7 +272,7 @@ public class CompiledAutomaton {
}
}
- final List<Integer> stack = new ArrayList<Integer>();
+ final List<Integer> stack = new ArrayList<>();
int idx = 0;
while (true) {
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/DaciukMihovAutomatonBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/DaciukMihovAutomatonBuilder.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/DaciukMihovAutomatonBuilder.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/DaciukMihovAutomatonBuilder.java Wed Mar 12 14:39:17 2014
@@ -187,7 +187,7 @@ final class DaciukMihovAutomatonBuilder
/**
* A "registry" for state interning.
*/
- private HashMap<State,State> stateRegistry = new HashMap<State,State>();
+ private HashMap<State,State> stateRegistry = new HashMap<>();
/**
* Root automaton state.
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/LevenshteinAutomata.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/LevenshteinAutomata.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/LevenshteinAutomata.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/LevenshteinAutomata.java Wed Mar 12 14:39:17 2014
@@ -63,7 +63,7 @@ public class LevenshteinAutomata {
this.alphaMax = alphaMax;
// calculate the alphabet
- SortedSet<Integer> set = new TreeSet<Integer>();
+ SortedSet<Integer> set = new TreeSet<>();
for (int i = 0; i < word.length; i++) {
int v = word[i];
if (v > alphaMax) {
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/MinimizationOperations.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/MinimizationOperations.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/MinimizationOperations.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/MinimizationOperations.java Wed Mar 12 14:39:17 2014
@@ -83,13 +83,13 @@ final public class MinimizationOperation
final int[] block = new int[statesLen];
final StateList[][] active = new StateList[statesLen][sigmaLen];
final StateListNode[][] active2 = new StateListNode[statesLen][sigmaLen];
- final LinkedList<IntPair> pending = new LinkedList<IntPair>();
+ final LinkedList<IntPair> pending = new LinkedList<>();
final BitSet pending2 = new BitSet(sigmaLen*statesLen);
final BitSet split = new BitSet(statesLen),
refine = new BitSet(statesLen), refine2 = new BitSet(statesLen);
for (int q = 0; q < statesLen; q++) {
- splitblock[q] = new ArrayList<State>();
- partition[q] = new HashSet<State>();
+ splitblock[q] = new ArrayList<>();
+ partition[q] = new HashSet<>();
for (int x = 0; x < sigmaLen; x++) {
active[q][x] = new StateList();
}
@@ -104,7 +104,7 @@ final public class MinimizationOperation
final ArrayList<State>[] r =
reverse[qq.step(sigma[x]).number];
if (r[x] == null)
- r[x] = new ArrayList<State>();
+ r[x] = new ArrayList<>();
r[x].add(qq);
}
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java Wed Mar 12 14:39:17 2014
@@ -486,14 +486,14 @@ public class RegExp {
Automaton a = null;
switch (kind) {
case REGEXP_UNION:
- list = new ArrayList<Automaton>();
+ list = new ArrayList<>();
findLeaves(exp1, Kind.REGEXP_UNION, list, automata, automaton_provider);
findLeaves(exp2, Kind.REGEXP_UNION, list, automata, automaton_provider);
a = BasicOperations.union(list);
MinimizationOperations.minimize(a);
break;
case REGEXP_CONCATENATION:
- list = new ArrayList<Automaton>();
+ list = new ArrayList<>();
findLeaves(exp1, Kind.REGEXP_CONCATENATION, list, automata,
automaton_provider);
findLeaves(exp2, Kind.REGEXP_CONCATENATION, list, automata,
@@ -664,7 +664,7 @@ public class RegExp {
* Returns set of automaton identifiers that occur in this regular expression.
*/
public Set<String> getIdentifiers() {
- HashSet<String> set = new HashSet<String>();
+ HashSet<String> set = new HashSet<>();
getIdentifiers(set);
return set;
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/SortedIntSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/SortedIntSet.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/SortedIntSet.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/SortedIntSet.java Wed Mar 12 14:39:17 2014
@@ -35,7 +35,7 @@ final class SortedIntSet {
// O(N^2) linear ops to O(N log(N)) TreeMap
private final static int TREE_MAP_CUTOVER = 30;
- private final Map<Integer,Integer> map = new TreeMap<Integer,Integer>();
+ private final Map<Integer,Integer> map = new TreeMap<>();
private boolean useTreeMap;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/SpecialOperations.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/SpecialOperations.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/SpecialOperations.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/SpecialOperations.java Wed Mar 12 14:39:17 2014
@@ -95,7 +95,7 @@ final public class SpecialOperations {
public static String getCommonPrefix(Automaton a) {
if (a.isSingleton()) return a.singleton;
StringBuilder b = new StringBuilder();
- HashSet<State> visited = new HashSet<State>();
+ HashSet<State> visited = new HashSet<>();
State s = a.initial;
boolean done;
do {
@@ -119,7 +119,7 @@ final public class SpecialOperations {
public static BytesRef getCommonPrefixBytesRef(Automaton a) {
if (a.isSingleton()) return new BytesRef(a.singleton);
BytesRef ref = new BytesRef(10);
- HashSet<State> visited = new HashSet<State>();
+ HashSet<State> visited = new HashSet<>();
State s = a.initial;
boolean done;
do {
@@ -185,9 +185,9 @@ final public class SpecialOperations {
public static Set<State> reverse(Automaton a) {
a.expandSingleton();
// reverse all edges
- HashMap<State, HashSet<Transition>> m = new HashMap<State, HashSet<Transition>>();
+ HashMap<State, HashSet<Transition>> m = new HashMap<>();
State[] states = a.getNumberedStates();
- Set<State> accept = new HashSet<State>();
+ Set<State> accept = new HashSet<>();
for (State s : states)
if (s.isAccept())
accept.add(s);
@@ -223,7 +223,7 @@ final public class SpecialOperations {
* the limit is infinite.
*/
public static Set<IntsRef> getFiniteStrings(Automaton a, int limit) {
- HashSet<IntsRef> strings = new HashSet<IntsRef>();
+ HashSet<IntsRef> strings = new HashSet<>();
if (a.isSingleton()) {
if (limit > 0) {
strings.add(Util.toUTF32(a.singleton, new IntsRef()));
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/UTF32ToUTF8.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/UTF32ToUTF8.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/UTF32ToUTF8.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/UTF32ToUTF8.java Wed Mar 12 14:39:17 2014
@@ -261,7 +261,7 @@ public final class UTF32ToUTF8 {
}
State[] map = new State[utf32.getNumberedStates().length];
- List<State> pending = new ArrayList<State>();
+ List<State> pending = new ArrayList<>();
State utf32State = utf32.getInitialState();
pending.add(utf32State);
Automaton utf8 = new Automaton();
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Builder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Builder.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Builder.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Builder.java Wed Mar 12 14:39:17 2014
@@ -160,9 +160,9 @@ public class Builder<T> {
this.shareMaxTailLength = shareMaxTailLength;
this.doPackFST = doPackFST;
this.acceptableOverheadRatio = acceptableOverheadRatio;
- fst = new FST<T>(inputType, outputs, doPackFST, acceptableOverheadRatio, allowArrayArcs, bytesPageBits);
+ fst = new FST<>(inputType, outputs, doPackFST, acceptableOverheadRatio, allowArrayArcs, bytesPageBits);
if (doShareSuffix) {
- dedupHash = new NodeHash<T>(fst, fst.bytes.getReverseReader(false));
+ dedupHash = new NodeHash<>(fst, fst.bytes.getReverseReader(false));
} else {
dedupHash = null;
}
@@ -172,7 +172,7 @@ public class Builder<T> {
(UnCompiledNode<T>[]) new UnCompiledNode[10];
frontier = f;
for(int idx=0;idx<frontier.length;idx++) {
- frontier[idx] = new UnCompiledNode<T>(this, idx);
+ frontier[idx] = new UnCompiledNode<>(this, idx);
}
}
@@ -301,7 +301,7 @@ public class Builder<T> {
// undecided on whether to prune it. later, it
// will be either compiled or pruned, so we must
// allocate a new node:
- frontier[idx] = new UnCompiledNode<T>(this, idx);
+ frontier[idx] = new UnCompiledNode<>(this, idx);
}
}
}
@@ -384,7 +384,7 @@ public class Builder<T> {
new UnCompiledNode[ArrayUtil.oversize(input.length+1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
System.arraycopy(frontier, 0, next, 0, frontier.length);
for(int idx=frontier.length;idx<next.length;idx++) {
- next[idx] = new UnCompiledNode<T>(this, idx);
+ next[idx] = new UnCompiledNode<>(this, idx);
}
frontier = next;
}
@@ -553,7 +553,7 @@ public class Builder<T> {
public UnCompiledNode(Builder<T> owner, int depth) {
this.owner = owner;
arcs = (Arc<T>[]) new Arc[1];
- arcs[0] = new Arc<T>();
+ arcs[0] = new Arc<>();
output = owner.NO_OUTPUT;
this.depth = depth;
}
@@ -587,7 +587,7 @@ public class Builder<T> {
new Arc[ArrayUtil.oversize(numArcs+1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
System.arraycopy(arcs, 0, newArcs, 0, arcs.length);
for(int arcIdx=numArcs;arcIdx<newArcs.length;arcIdx++) {
- newArcs[arcIdx] = new Arc<T>();
+ newArcs[arcIdx] = new Arc<>();
}
arcs = newArcs;
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/BytesRefFSTEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/BytesRefFSTEnum.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/BytesRefFSTEnum.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/BytesRefFSTEnum.java Wed Mar 12 14:39:17 2014
@@ -30,7 +30,7 @@ import org.apache.lucene.util.BytesRef;
public final class BytesRefFSTEnum<T> extends FSTEnum<T> {
private final BytesRef current = new BytesRef(10);
- private final InputOutput<T> result = new InputOutput<T>();
+ private final InputOutput<T> result = new InputOutput<>();
private BytesRef target;
/** Holds a single input (BytesRef) + output pair. */
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/BytesStore.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/BytesStore.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/BytesStore.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/BytesStore.java Wed Mar 12 14:39:17 2014
@@ -29,7 +29,7 @@ import org.apache.lucene.store.DataOutpu
class BytesStore extends DataOutput {
- private final List<byte[]> blocks = new ArrayList<byte[]>();
+ private final List<byte[]> blocks = new ArrayList<>();
private final int blockSize;
private final int blockBits;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java Wed Mar 12 14:39:17 2014
@@ -437,7 +437,7 @@ public final class FST<T> {
}
public void readRootArcs(Arc<T>[] arcs) throws IOException {
- final Arc<T> arc = new Arc<T>();
+ final Arc<T> arc = new Arc<>();
getFirstArc(arc);
final BytesReader in = getBytesReader();
if (targetHasArcs(arc)) {
@@ -592,7 +592,7 @@ public final class FST<T> {
InputStream is = new BufferedInputStream(new FileInputStream(file));
boolean success = false;
try {
- FST<T> fst = new FST<T>(new InputStreamDataInput(is), outputs);
+ FST<T> fst = new FST<>(new InputStreamDataInput(is), outputs);
success = true;
return fst;
} finally {
@@ -1349,7 +1349,7 @@ public final class FST<T> {
// TODO: must assert this FST was built with
// "willRewrite"
- final List<ArcAndState<T>> queue = new ArrayList<ArcAndState<T>>();
+ final List<ArcAndState<T>> queue = new ArrayList<>();
// TODO: use bitset to not revisit nodes already
// visited
@@ -1358,7 +1358,7 @@ public final class FST<T> {
int saved = 0;
queue.add(new ArcAndState<T>(getFirstArc(new Arc<T>()), new IntsRef()));
- Arc<T> scratchArc = new Arc<T>();
+ Arc<T> scratchArc = new Arc<>();
while(queue.size() > 0) {
//System.out.println("cycle size=" + queue.size());
//for(ArcAndState<T> ent : queue) {
@@ -1499,7 +1499,7 @@ public final class FST<T> {
throw new IllegalArgumentException("this FST was not built with willPackFST=true");
}
- Arc<T> arc = new Arc<T>();
+ Arc<T> arc = new Arc<>();
final BytesReader r = getBytesReader();
@@ -1526,7 +1526,7 @@ public final class FST<T> {
// Free up RAM:
inCounts = null;
- final Map<Integer,Integer> topNodeMap = new HashMap<Integer,Integer>();
+ final Map<Integer,Integer> topNodeMap = new HashMap<>();
for(int downTo=q.size()-1;downTo>=0;downTo--) {
NodeAndInCount n = q.pop();
topNodeMap.put(n.node, downTo);
@@ -1558,7 +1558,7 @@ public final class FST<T> {
// for assert:
boolean negDelta = false;
- fst = new FST<T>(inputType, outputs, bytes.getBlockBits());
+ fst = new FST<>(inputType, outputs, bytes.getBlockBits());
final BytesStore writer = fst.bytes;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FSTEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FSTEnum.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FSTEnum.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FSTEnum.java Wed Mar 12 14:39:17 2014
@@ -36,7 +36,7 @@ abstract class FSTEnum<T> {
protected final T NO_OUTPUT;
protected final FST.BytesReader fstReader;
- protected final FST.Arc<T> scratchArc = new FST.Arc<T>();
+ protected final FST.Arc<T> scratchArc = new FST.Arc<>();
protected int upto;
protected int targetLength;
@@ -522,7 +522,7 @@ abstract class FSTEnum<T> {
private FST.Arc<T> getArc(int idx) {
if (arcs[idx] == null) {
- arcs[idx] = new FST.Arc<T>();
+ arcs[idx] = new FST.Arc<>();
}
return arcs[idx];
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/IntsRefFSTEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/IntsRefFSTEnum.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/IntsRefFSTEnum.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/IntsRefFSTEnum.java Wed Mar 12 14:39:17 2014
@@ -30,7 +30,7 @@ import java.io.IOException;
public final class IntsRefFSTEnum<T> extends FSTEnum<T> {
private final IntsRef current = new IntsRef(10);
- private final InputOutput<T> result = new InputOutput<T>();
+ private final InputOutput<T> result = new InputOutput<>();
private IntsRef target;
/** Holds a single input (IntsRef) + output pair. */
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/NodeHash.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/NodeHash.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/NodeHash.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/NodeHash.java Wed Mar 12 14:39:17 2014
@@ -29,7 +29,7 @@ final class NodeHash<T> {
private long count;
private long mask;
private final FST<T> fst;
- private final FST.Arc<T> scratchArc = new FST.Arc<T>();
+ private final FST.Arc<T> scratchArc = new FST.Arc<>();
private final FST.BytesReader in;
public NodeHash(FST<T> fst, FST.BytesReader in) {
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/PairOutputs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/PairOutputs.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/PairOutputs.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/PairOutputs.java Wed Mar 12 14:39:17 2014
@@ -66,7 +66,7 @@ public class PairOutputs<A,B> extends Ou
public PairOutputs(Outputs<A> outputs1, Outputs<B> outputs2) {
this.outputs1 = outputs1;
this.outputs2 = outputs2;
- NO_OUTPUT = new Pair<A,B>(outputs1.getNoOutput(), outputs2.getNoOutput());
+ NO_OUTPUT = new Pair<>(outputs1.getNoOutput(), outputs2.getNoOutput());
}
/** Create a new Pair */
@@ -81,7 +81,7 @@ public class PairOutputs<A,B> extends Ou
if (a == outputs1.getNoOutput() && b == outputs2.getNoOutput()) {
return NO_OUTPUT;
} else {
- final Pair<A,B> p = new Pair<A,B>(a, b);
+ final Pair<A,B> p = new Pair<>(a, b);
assert valid(p);
return p;
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/Util.java Wed Mar 12 14:39:17 2014
@@ -104,7 +104,7 @@ public final class Util {
// TODO: would be nice not to alloc this on every lookup
FST.Arc<Long> arc = fst.getFirstArc(new FST.Arc<Long>());
- FST.Arc<Long> scratchArc = new FST.Arc<Long>();
+ FST.Arc<Long> scratchArc = new FST.Arc<>();
final IntsRef result = new IntsRef();
@@ -288,7 +288,7 @@ public final class Util {
private final int topN;
private final int maxQueueDepth;
- private final FST.Arc<T> scratchArc = new FST.Arc<T>();
+ private final FST.Arc<T> scratchArc = new FST.Arc<>();
final Comparator<T> comparator;
@@ -301,7 +301,7 @@ public final class Util {
this.maxQueueDepth = maxQueueDepth;
this.comparator = comparator;
- queue = new TreeSet<FSTPath<T>>(new TieBreakByInputComparator<T>(comparator));
+ queue = new TreeSet<>(new TieBreakByInputComparator<>(comparator));
}
// If back plus this arc is competitive then add to queue:
@@ -344,7 +344,7 @@ public final class Util {
System.arraycopy(path.input.ints, 0, newInput.ints, 0, path.input.length);
newInput.ints[path.input.length] = path.arc.label;
newInput.length = path.input.length+1;
- final FSTPath<T> newPath = new FSTPath<T>(cost, path.arc, newInput);
+ final FSTPath<T> newPath = new FSTPath<>(cost, path.arc, newInput);
queue.add(newPath);
@@ -362,7 +362,7 @@ public final class Util {
startOutput = fst.outputs.getNoOutput();
}
- FSTPath<T> path = new FSTPath<T>(startOutput, node, input);
+ FSTPath<T> path = new FSTPath<>(startOutput, node, input);
fst.readFirstTargetArc(node, path.arc, bytesReader);
//System.out.println("add start paths");
@@ -381,7 +381,7 @@ public final class Util {
public MinResult<T>[] search() throws IOException {
- final List<MinResult<T>> results = new ArrayList<MinResult<T>>();
+ final List<MinResult<T>> results = new ArrayList<>();
//System.out.println("search topN=" + topN);
@@ -422,7 +422,7 @@ public final class Util {
//System.out.println(" empty string! cost=" + path.cost);
// Empty string!
path.input.length--;
- results.add(new MinResult<T>(path.input, path.cost));
+ results.add(new MinResult<>(path.input, path.cost));
continue;
}
@@ -486,7 +486,7 @@ public final class Util {
T finalOutput = fst.outputs.add(path.cost, path.arc.output);
if (acceptResult(path.input, finalOutput)) {
//System.out.println(" add result: " + path);
- results.add(new MinResult<T>(path.input, finalOutput));
+ results.add(new MinResult<>(path.input, finalOutput));
} else {
rejectCount++;
assert rejectCount + topN <= maxQueueDepth: "maxQueueDepth (" + maxQueueDepth + ") is too small for topN (" + topN + "): rejected " + rejectCount + " paths";
@@ -529,7 +529,7 @@ public final class Util {
// All paths are kept, so we can pass topN for
// maxQueueDepth and the pruning is admissible:
- TopNSearcher<T> searcher = new TopNSearcher<T>(fst, topN, topN, comparator);
+ TopNSearcher<T> searcher = new TopNSearcher<>(fst, topN, topN, comparator);
// since this search is initialized with a single start node
// it is okay to start with an empty input path here
@@ -578,15 +578,15 @@ public final class Util {
final FST.Arc<T> startArc = fst.getFirstArc(new FST.Arc<T>());
// A queue of transitions to consider for the next level.
- final List<FST.Arc<T>> thisLevelQueue = new ArrayList<FST.Arc<T>>();
+ final List<FST.Arc<T>> thisLevelQueue = new ArrayList<>();
// A queue of transitions to consider when processing the next level.
- final List<FST.Arc<T>> nextLevelQueue = new ArrayList<FST.Arc<T>>();
+ final List<FST.Arc<T>> nextLevelQueue = new ArrayList<>();
nextLevelQueue.add(startArc);
//System.out.println("toDot: startArc: " + startArc);
// A list of states on the same level (for ranking).
- final List<Integer> sameLevelStates = new ArrayList<Integer>();
+ final List<Integer> sameLevelStates = new ArrayList<>();
// A bitset of already seen states (target offset).
final BitSet seen = new BitSet();
@@ -609,7 +609,7 @@ public final class Util {
final T NO_OUTPUT = fst.outputs.getNoOutput();
final BytesReader r = fst.getBytesReader();
- // final FST.Arc<T> scratchArc = new FST.Arc<T>();
+ // final FST.Arc<T> scratchArc = new FST.Arc<>();
{
final String stateColor;
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/TestSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/TestSearch.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/TestSearch.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/TestSearch.java Wed Mar 12 14:39:17 2014
@@ -159,7 +159,7 @@ public class TestSearch extends LuceneTe
}
private List<Query> buildQueries() {
- List<Query> queries = new ArrayList<Query>();
+ List<Query> queries = new ArrayList<>();
BooleanQuery booleanAB = new BooleanQuery();
booleanAB.add(new TermQuery(new Term("contents", "a")), BooleanClause.Occur.SHOULD);
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TestGraphTokenizers.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TestGraphTokenizers.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TestGraphTokenizers.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TestGraphTokenizers.java Wed Mar 12 14:39:17 2014
@@ -118,7 +118,7 @@ public class TestGraphTokenizers extends
final String[] parts = sb.toString().split(" ");
- tokens = new ArrayList<Token>();
+ tokens = new ArrayList<>();
int pos = 0;
int maxPos = -1;
int offset = 0;
@@ -454,7 +454,7 @@ public class TestGraphTokenizers extends
private static final Automaton HOLE_A = BasicAutomata.makeChar(TokenStreamToAutomaton.HOLE);
private Automaton join(String ... strings) {
- List<Automaton> as = new ArrayList<Automaton>();
+ List<Automaton> as = new ArrayList<>();
for(String s : strings) {
as.add(BasicAutomata.makeString(s));
as.add(SEP_A);
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TrivialLookaheadFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TrivialLookaheadFilter.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TrivialLookaheadFilter.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TrivialLookaheadFilter.java Wed Mar 12 14:39:17 2014
@@ -78,7 +78,7 @@ final public class TrivialLookaheadFilte
}
private void peekSentence() throws IOException {
- List<String> facts = new ArrayList<String>();
+ List<String> facts = new ArrayList<>();
boolean haveSentence = false;
do {
if (peekToken()) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestLucene40PostingsReader.java Wed Mar 12 14:39:17 2014
@@ -112,7 +112,7 @@ public class TestLucene40PostingsReader
}
String fieldValue(int maxTF) {
- ArrayList<String> shuffled = new ArrayList<String>();
+ ArrayList<String> shuffled = new ArrayList<>();
StringBuilder sb = new StringBuilder();
int i = random().nextInt(terms.length);
while (i < terms.length) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene40/TestReuseDocsEnum.java Wed Mar 12 14:39:17 2014
@@ -62,7 +62,7 @@ public class TestReuseDocsEnum extends L
AtomicReader indexReader = ctx.reader();
Terms terms = indexReader.terms("body");
TermsEnum iterator = terms.iterator(null);
- IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
+ IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<>();
MatchNoBits bits = new Bits.MatchNoBits(indexReader.maxDoc());
while ((iterator.next()) != null) {
DocsEnum docs = iterator.docs(random().nextBoolean() ? bits : new Bits.MatchNoBits(indexReader.maxDoc()), null, random().nextBoolean() ? DocsEnum.FLAG_FREQS : DocsEnum.FLAG_NONE);
@@ -88,7 +88,7 @@ public class TestReuseDocsEnum extends L
for (AtomicReaderContext ctx : open.leaves()) {
Terms terms = ctx.reader().terms("body");
TermsEnum iterator = terms.iterator(null);
- IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
+ IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<>();
MatchNoBits bits = new Bits.MatchNoBits(open.maxDoc());
DocsEnum docs = null;
while ((iterator.next()) != null) {
@@ -139,7 +139,7 @@ public class TestReuseDocsEnum extends L
for (AtomicReaderContext ctx : leaves) {
Terms terms = ctx.reader().terms("body");
TermsEnum iterator = terms.iterator(null);
- IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
+ IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<>();
MatchNoBits bits = new Bits.MatchNoBits(firstReader.maxDoc());
iterator = terms.iterator(null);
DocsEnum docs = null;
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/lucene41/TestBlockPostingsFormat3.java Wed Mar 12 14:39:17 2014
@@ -201,7 +201,7 @@ public class TestBlockPostingsFormat3 ex
Random random = random();
// collect this number of terms from the left side
- HashSet<BytesRef> tests = new HashSet<BytesRef>();
+ HashSet<BytesRef> tests = new HashSet<>();
int numPasses = 0;
while (numPasses < 10 && tests.size() < numTests) {
leftEnum = leftTerms.iterator(leftEnum);
@@ -228,7 +228,7 @@ public class TestBlockPostingsFormat3 ex
numPasses++;
}
- ArrayList<BytesRef> shuffledTests = new ArrayList<BytesRef>(tests);
+ ArrayList<BytesRef> shuffledTests = new ArrayList<>(tests);
Collections.shuffle(shuffledTests, random);
for (BytesRef b : shuffledTests) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java Wed Mar 12 14:39:17 2014
@@ -52,7 +52,7 @@ public class Test2BTerms extends LuceneT
private final int tokensPerDoc;
private int tokenCount;
- public final List<BytesRef> savedTerms = new ArrayList<BytesRef>();
+ public final List<BytesRef> savedTerms = new ArrayList<>();
private int nextSave;
private final Random random;
@@ -204,7 +204,7 @@ public class Test2BTerms extends LuceneT
savedTerms = findTerms(r);
}
final int numSavedTerms = savedTerms.size();
- final List<BytesRef> bigOrdTerms = new ArrayList<BytesRef>(savedTerms.subList(numSavedTerms-10, numSavedTerms));
+ final List<BytesRef> bigOrdTerms = new ArrayList<>(savedTerms.subList(numSavedTerms-10, numSavedTerms));
System.out.println("TEST: test big ord terms...");
testSavedTerms(r, bigOrdTerms);
System.out.println("TEST: test all saved terms...");
@@ -223,7 +223,7 @@ public class Test2BTerms extends LuceneT
private List<BytesRef> findTerms(IndexReader r) throws IOException {
System.out.println("TEST: findTerms");
final TermsEnum termsEnum = MultiFields.getTerms(r, "field").iterator(null);
- final List<BytesRef> savedTerms = new ArrayList<BytesRef>();
+ final List<BytesRef> savedTerms = new ArrayList<>();
int nextSave = TestUtil.nextInt(random(), 500000, 1000000);
BytesRef term;
while((term = termsEnum.next()) != null) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java Wed Mar 12 14:39:17 2014
@@ -653,7 +653,7 @@ public class TestAddIndexes extends Luce
Directory dir, dir2;
final static int NUM_INIT_DOCS = 17;
IndexWriter writer2;
- final List<Throwable> failures = new ArrayList<Throwable>();
+ final List<Throwable> failures = new ArrayList<>();
volatile boolean didClose;
final IndexReader[] readers;
final int NUM_COPY;
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Wed Mar 12 14:39:17 2014
@@ -222,10 +222,10 @@ public class TestBackwardsCompatibility
@BeforeClass
public static void beforeClass() throws Exception {
assertFalse("test infra is broken!", LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE);
- List<String> names = new ArrayList<String>(oldNames.length + oldSingleSegmentNames.length);
+ List<String> names = new ArrayList<>(oldNames.length + oldSingleSegmentNames.length);
names.addAll(Arrays.asList(oldNames));
names.addAll(Arrays.asList(oldSingleSegmentNames));
- oldIndexDirs = new HashMap<String,Directory>();
+ oldIndexDirs = new HashMap<>();
for (String name : names) {
File dir = TestUtil.getTempDir(name);
File dataFile = new File(TestBackwardsCompatibility.class.getResource("index." + name + ".zip").toURI());
@@ -935,7 +935,7 @@ public class TestBackwardsCompatibility
}
public void testUpgradeOldIndex() throws Exception {
- List<String> names = new ArrayList<String>(oldNames.length + oldSingleSegmentNames.length);
+ List<String> names = new ArrayList<>(oldNames.length + oldSingleSegmentNames.length);
names.addAll(Arrays.asList(oldNames));
names.addAll(Arrays.asList(oldSingleSegmentNames));
for(String name : names) {
@@ -961,7 +961,7 @@ public class TestBackwardsCompatibility
String path = dir.getAbsolutePath();
- List<String> args = new ArrayList<String>();
+ List<String> args = new ArrayList<>();
if (random().nextBoolean()) {
args.add("-verbose");
}
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java Wed Mar 12 14:39:17 2014
@@ -43,7 +43,7 @@ import org.apache.lucene.util.TestUtil;
@SuppressCodecs({"Direct", "Memory"}) // at night this makes like 200k/300k docs and will make Direct's heart beat!
public class TestBagOfPositions extends LuceneTestCase {
public void test() throws Exception {
- List<String> postingsList = new ArrayList<String>();
+ List<String> postingsList = new ArrayList<>();
int numTerms = atLeast(300);
final int maxTermsPerDoc = TestUtil.nextInt(random(), 10, 20);
boolean isSimpleText = "SimpleText".equals(TestUtil.getPostingsFormat("field"));
@@ -66,7 +66,7 @@ public class TestBagOfPositions extends
}
Collections.shuffle(postingsList, random());
- final ConcurrentLinkedQueue<String> postings = new ConcurrentLinkedQueue<String>(postingsList);
+ final ConcurrentLinkedQueue<String> postings = new ConcurrentLinkedQueue<>(postingsList);
Directory dir = newFSDirectory(TestUtil.getTempDir("bagofpositions"));
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java Wed Mar 12 14:39:17 2014
@@ -42,7 +42,7 @@ import org.apache.lucene.util.TestUtil;
@SuppressCodecs({"Direct", "Memory"}) // at night this makes like 200k/300k docs and will make Direct's heart beat!
public class TestBagOfPostings extends LuceneTestCase {
public void test() throws Exception {
- List<String> postingsList = new ArrayList<String>();
+ List<String> postingsList = new ArrayList<>();
int numTerms = atLeast(300);
final int maxTermsPerDoc = TestUtil.nextInt(random(), 10, 20);
@@ -68,7 +68,7 @@ public class TestBagOfPostings extends L
}
Collections.shuffle(postingsList, random());
- final ConcurrentLinkedQueue<String> postings = new ConcurrentLinkedQueue<String>(postingsList);
+ final ConcurrentLinkedQueue<String> postings = new ConcurrentLinkedQueue<>(postingsList);
Directory dir = newFSDirectory(TestUtil.getTempDir("bagofpostings"));
final RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwc);
@@ -93,7 +93,7 @@ public class TestBagOfPostings extends L
startingGun.await();
while (!postings.isEmpty()) {
StringBuilder text = new StringBuilder();
- Set<String> visited = new HashSet<String>();
+ Set<String> visited = new HashSet<>();
for (int i = 0; i < maxTermsPerDoc; i++) {
String token = postings.poll();
if (token == null) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java Wed Mar 12 14:39:17 2014
@@ -90,7 +90,7 @@ public class TestCheckIndex extends Luce
assertEquals(18, seg.termVectorStatus.totVectors);
assertTrue(seg.diagnostics.size() > 0);
- final List<String> onlySegments = new ArrayList<String>();
+ final List<String> onlySegments = new ArrayList<>();
onlySegments.add("_0");
assertTrue(checker.checkIndex(onlySegments).clean == true);
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java Wed Mar 12 14:39:17 2014
@@ -180,7 +180,7 @@ public class TestCodecs extends LuceneTe
//final int numTerms = 2;
final TermData[] terms = new TermData[numTerms];
- final HashSet<String> termsSeen = new HashSet<String>();
+ final HashSet<String> termsSeen = new HashSet<>();
for(int i=0;i<numTerms;i++) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDeletionPolicy.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDeletionPolicy.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDeletionPolicy.java Wed Mar 12 14:39:17 2014
@@ -120,7 +120,7 @@ public class TestDeletionPolicy extends
int numOnCommit;
int numToKeep;
int numDelete;
- Set<String> seen = new HashSet<String>();
+ Set<String> seen = new HashSet<>();
public KeepLastNDeletionPolicy(int numToKeep) {
this.numToKeep = numToKeep;
@@ -228,7 +228,7 @@ public class TestDeletionPolicy extends
mp.setNoCFSRatio(1.0);
IndexWriter writer = new IndexWriter(dir, conf);
ExpirationTimeDeletionPolicy policy = (ExpirationTimeDeletionPolicy) writer.getConfig().getIndexDeletionPolicy();
- Map<String,String> commitData = new HashMap<String,String>();
+ Map<String,String> commitData = new HashMap<>();
commitData.put("commitTime", String.valueOf(System.currentTimeMillis()));
writer.setCommitData(commitData);
writer.commit();
@@ -250,7 +250,7 @@ public class TestDeletionPolicy extends
for(int j=0;j<17;j++) {
addDoc(writer);
}
- commitData = new HashMap<String,String>();
+ commitData = new HashMap<>();
commitData.put("commitTime", String.valueOf(System.currentTimeMillis()));
writer.setCommitData(commitData);
writer.commit();
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java Wed Mar 12 14:39:17 2014
@@ -250,10 +250,10 @@ public class TestDirectoryReader extends
reader = DirectoryReader.open(d);
fieldInfos = MultiFields.getMergedFieldInfos(reader);
- Collection<String> allFieldNames = new HashSet<String>();
- Collection<String> indexedFieldNames = new HashSet<String>();
- Collection<String> notIndexedFieldNames = new HashSet<String>();
- Collection<String> tvFieldNames = new HashSet<String>();
+ Collection<String> allFieldNames = new HashSet<>();
+ Collection<String> indexedFieldNames = new HashSet<>();
+ Collection<String> notIndexedFieldNames = new HashSet<>();
+ Collection<String> tvFieldNames = new HashSet<>();
for(FieldInfo fieldInfo : fieldInfos) {
final String name = fieldInfo.name;
@@ -743,7 +743,7 @@ public void testFilesOpenClose() throws
Collection<IndexCommit> commits = DirectoryReader.listCommits(dir);
for (final IndexCommit commit : commits) {
Collection<String> files = commit.getFileNames();
- HashSet<String> seen = new HashSet<String>();
+ HashSet<String> seen = new HashSet<>();
for (final String fileName : files) {
assertTrue("file " + fileName + " was duplicated", !seen.contains(fileName));
seen.add(fileName);
@@ -1079,7 +1079,7 @@ public void testFilesOpenClose() throws
writer.addDocument(doc);
DirectoryReader r = writer.getReader();
writer.close();
- Set<String> fieldsToLoad = new HashSet<String>();
+ Set<String> fieldsToLoad = new HashSet<>();
assertEquals(0, r.document(0, fieldsToLoad).getFields().size());
fieldsToLoad.add("field1");
StoredDocument doc2 = r.document(0, fieldsToLoad);
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReaderReopen.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReaderReopen.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDirectoryReaderReopen.java Wed Mar 12 14:39:17 2014
@@ -552,14 +552,14 @@ public class TestDirectoryReaderReopen e
Document doc = new Document();
doc.add(newStringField("id", ""+i, Field.Store.NO));
writer.addDocument(doc);
- Map<String,String> data = new HashMap<String,String>();
+ Map<String,String> data = new HashMap<>();
data.put("index", i+"");
writer.setCommitData(data);
writer.commit();
}
for(int i=0;i<4;i++) {
writer.deleteDocuments(new Term("id", ""+i));
- Map<String,String> data = new HashMap<String,String>();
+ Map<String,String> data = new HashMap<>();
data.put("index", (4+i)+"");
writer.setCommitData(data);
writer.commit();
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDoc.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDoc.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDoc.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDoc.java Wed Mar 12 14:39:17 2014
@@ -71,7 +71,7 @@ public class TestDoc extends LuceneTestC
Directory directory = newFSDirectory(indexDir);
directory.close();
- files = new LinkedList<File>();
+ files = new LinkedList<>();
files.add(createOutput("test.txt",
"This is the first test file"
));
@@ -229,7 +229,7 @@ public class TestDoc extends LuceneTestC
final SegmentInfo info = new SegmentInfo(si1.info.dir, Constants.LUCENE_MAIN_VERSION, merged,
si1.info.getDocCount() + si2.info.getDocCount(),
false, codec, null);
- info.setFiles(new HashSet<String>(trackingDir.getCreatedFiles()));
+ info.setFiles(new HashSet<>(trackingDir.getCreatedFiles()));
if (useCompoundFile) {
Collection<String> filesToDelete = IndexWriter.createCompoundFile(InfoStream.getDefault(), dir, MergeState.CheckAbort.NONE, info, newIOContext(random()));
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocTermOrds.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocTermOrds.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocTermOrds.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocTermOrds.java Wed Mar 12 14:39:17 2014
@@ -95,7 +95,7 @@ public class TestDocTermOrds extends Luc
Directory dir = newDirectory();
final int NUM_TERMS = atLeast(20);
- final Set<BytesRef> terms = new HashSet<BytesRef>();
+ final Set<BytesRef> terms = new HashSet<>();
while(terms.size() < NUM_TERMS) {
final String s = TestUtil.randomRealisticUnicodeString(random());
//final String s = _TestUtil.randomSimpleString(random);
@@ -120,7 +120,7 @@ public class TestDocTermOrds extends Luc
final RandomIndexWriter w = new RandomIndexWriter(random(), dir, conf);
final int[][] idToOrds = new int[NUM_DOCS][];
- final Set<Integer> ordsForDocSet = new HashSet<Integer>();
+ final Set<Integer> ordsForDocSet = new HashSet<>();
for(int id=0;id<NUM_DOCS;id++) {
Document doc = new Document();
@@ -181,7 +181,7 @@ public class TestDocTermOrds extends Luc
public void testRandomWithPrefix() throws Exception {
Directory dir = newDirectory();
- final Set<String> prefixes = new HashSet<String>();
+ final Set<String> prefixes = new HashSet<>();
final int numPrefix = TestUtil.nextInt(random(), 2, 7);
if (VERBOSE) {
System.out.println("TEST: use " + numPrefix + " prefixes");
@@ -193,7 +193,7 @@ public class TestDocTermOrds extends Luc
final String[] prefixesArray = prefixes.toArray(new String[prefixes.size()]);
final int NUM_TERMS = atLeast(20);
- final Set<BytesRef> terms = new HashSet<BytesRef>();
+ final Set<BytesRef> terms = new HashSet<>();
while(terms.size() < NUM_TERMS) {
final String s = prefixesArray[random().nextInt(prefixesArray.length)] + TestUtil.randomRealisticUnicodeString(random());
//final String s = prefixesArray[random.nextInt(prefixesArray.length)] + _TestUtil.randomSimpleString(random);
@@ -217,7 +217,7 @@ public class TestDocTermOrds extends Luc
final RandomIndexWriter w = new RandomIndexWriter(random(), dir, conf);
final int[][] idToOrds = new int[NUM_DOCS][];
- final Set<Integer> ordsForDocSet = new HashSet<Integer>();
+ final Set<Integer> ordsForDocSet = new HashSet<>();
for(int id=0;id<NUM_DOCS;id++) {
Document doc = new Document();
@@ -262,7 +262,7 @@ public class TestDocTermOrds extends Luc
final int[][] idToOrdsPrefix = new int[NUM_DOCS][];
for(int id=0;id<NUM_DOCS;id++) {
final int[] docOrds = idToOrds[id];
- final List<Integer> newOrds = new ArrayList<Integer>();
+ final List<Integer> newOrds = new ArrayList<>();
for(int ord : idToOrds[id]) {
if (StringHelper.startsWith(termsArray[ord], prefixRef)) {
newOrds.add(ord);
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesWithThreads.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesWithThreads.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesWithThreads.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesWithThreads.java Wed Mar 12 14:39:17 2014
@@ -43,9 +43,9 @@ public class TestDocValuesWithThreads ex
Directory dir = newDirectory();
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy()));
- final List<Long> numbers = new ArrayList<Long>();
- final List<BytesRef> binary = new ArrayList<BytesRef>();
- final List<BytesRef> sorted = new ArrayList<BytesRef>();
+ final List<Long> numbers = new ArrayList<>();
+ final List<BytesRef> binary = new ArrayList<>();
+ final List<BytesRef> sorted = new ArrayList<>();
final int numDocs = atLeast(100);
for(int i=0;i<numDocs;i++) {
Document d = new Document();
@@ -69,7 +69,7 @@ public class TestDocValuesWithThreads ex
final AtomicReader ar = r.leaves().get(0).reader();
int numThreads = TestUtil.nextInt(random(), 2, 5);
- List<Thread> threads = new ArrayList<Thread>();
+ List<Thread> threads = new ArrayList<>();
final CountDownLatch startingGun = new CountDownLatch(1);
for(int t=0;t<numThreads;t++) {
final Random threadRandom = new Random(random().nextLong());
@@ -133,12 +133,12 @@ public class TestDocValuesWithThreads ex
final Directory dir = newDirectory();
final RandomIndexWriter writer = new RandomIndexWriter(random, dir);
final boolean allowDups = random.nextBoolean();
- final Set<String> seen = new HashSet<String>();
+ final Set<String> seen = new HashSet<>();
if (VERBOSE) {
System.out.println("TEST: NUM_DOCS=" + NUM_DOCS + " allowDups=" + allowDups);
}
int numDocs = 0;
- final List<BytesRef> docValues = new ArrayList<BytesRef>();
+ final List<BytesRef> docValues = new ArrayList<>();
// TODO: deletions
while (numDocs < NUM_DOCS) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocsAndPositions.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocsAndPositions.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocsAndPositions.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocsAndPositions.java Wed Mar 12 14:39:17 2014
@@ -120,7 +120,7 @@ public class TestDocsAndPositions extend
customType.setOmitNorms(true);
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
- ArrayList<Integer> positions = new ArrayList<Integer>();
+ ArrayList<Integer> positions = new ArrayList<>();
StringBuilder builder = new StringBuilder();
int num = atLeast(131);
for (int j = 0; j < num; j++) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterDeleteQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterDeleteQueue.java?rev=1576755&r1=1576754&r2=1576755&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterDeleteQueue.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterDeleteQueue.java Wed Mar 12 14:39:17 2014
@@ -47,7 +47,7 @@ public class TestDocumentsWriterDeleteQu
BufferedUpdates bd2 = new BufferedUpdates();
int last1 = 0;
int last2 = 0;
- Set<Term> uniqueValues = new HashSet<Term>();
+ Set<Term> uniqueValues = new HashSet<>();
for (int j = 0; j < ids.length; j++) {
Integer i = ids[j];
// create an array here since we compare identity below against tailItem
@@ -72,7 +72,7 @@ public class TestDocumentsWriterDeleteQu
}
assertEquals(uniqueValues, bd1.terms.keySet());
assertEquals(uniqueValues, bd2.terms.keySet());
- HashSet<Term> frozenSet = new HashSet<Term>();
+ HashSet<Term> frozenSet = new HashSet<>();
for (Term t : queue.freezeGlobalBuffer(null).termsIterable()) {
BytesRef bytesRef = new BytesRef();
bytesRef.copyBytes(t.bytes);
@@ -173,7 +173,7 @@ public class TestDocumentsWriterDeleteQu
public void testStressDeleteQueue() throws InterruptedException {
DocumentsWriterDeleteQueue queue = new DocumentsWriterDeleteQueue();
- Set<Term> uniqueValues = new HashSet<Term>();
+ Set<Term> uniqueValues = new HashSet<>();
final int size = 10000 + random().nextInt(500) * RANDOM_MULTIPLIER;
Integer[] ids = new Integer[size];
for (int i = 0; i < ids.length; i++) {
@@ -201,7 +201,7 @@ public class TestDocumentsWriterDeleteQu
assertEquals(uniqueValues, deletes.terms.keySet());
}
queue.tryApplyGlobalSlice();
- Set<Term> frozenSet = new HashSet<Term>();
+ Set<Term> frozenSet = new HashSet<>();
for (Term t : queue.freezeGlobalBuffer(null).termsIterable()) {
BytesRef bytesRef = new BytesRef();
bytesRef.copyBytes(t.bytes);