diff options
author | 2014-05-23 20:18:17 +0900 | |
---|---|---|
committer | 2014-05-24 01:05:42 +0900 | |
commit | a91561aa58db1c43092c1caecc051a11fa5391c7 (patch) | |
tree | 20864cd0644414688af87d59638b7a8ac59c2895 /tools/dicttool/src | |
parent | e782f1f4154690da356fac6939ded66b5f66864d (diff) | |
download | latinime-a91561aa58db1c43092c1caecc051a11fa5391c7.tar.gz latinime-a91561aa58db1c43092c1caecc051a11fa5391c7.tar.xz latinime-a91561aa58db1c43092c1caecc051a11fa5391c7.zip |
Use Java 7 diamond operator
Change-Id: If16ef50ae73147594615d0f49d6a22621eaf1aef
Diffstat (limited to 'tools/dicttool/src')
7 files changed, 17 insertions, 20 deletions
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java index f9771c8dd..2cbc04154 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java @@ -19,15 +19,14 @@ package com.android.inputmethod.latin.dicttool; import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils; import com.android.inputmethod.latin.makedict.BinaryDictIOUtils; import com.android.inputmethod.latin.makedict.DictDecoder; -import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.UnsupportedFormatException; import org.xml.sax.SAXException; -import java.io.File; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; +import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -54,7 +53,7 @@ public final class BinaryDictOffdeviceUtils { private final static int MAX_DECODE_DEPTH = 8; public static class DecoderChainSpec { - ArrayList<String> mDecoderSpec = new ArrayList<String>(); + ArrayList<String> mDecoderSpec = new ArrayList<>(); File mFile; public DecoderChainSpec addStep(final String stepDescription) { mDecoderSpec.add(stepDescription); diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java index 391328fda..6a0e1b7f0 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java @@ -98,7 +98,7 @@ public class CombinedInputOutput { headerLine = reader.readLine(); } final String header[] = headerLine.split(","); - final HashMap<String, String> attributes = new HashMap<String, String>(); + final HashMap<String, String> attributes = new HashMap<>(); for (String item : header) { final String keyValue[] = item.split("="); if (2 != keyValue.length) { @@ -115,8 +115,8 @@ public class CombinedInputOutput { String word = null; ProbabilityInfo probabilityInfo = new ProbabilityInfo(0); boolean isNotAWord = false; - ArrayList<WeightedString> bigrams = new ArrayList<WeightedString>(); - ArrayList<WeightedString> shortcuts = new ArrayList<WeightedString>(); + ArrayList<WeightedString> bigrams = new ArrayList<>(); + ArrayList<WeightedString> shortcuts = new ArrayList<>(); while (null != (line = reader.readLine())) { if (line.startsWith(COMMENT_LINE_STARTER)) continue; final String args[] = line.trim().split(","); @@ -128,8 +128,8 @@ public class CombinedInputOutput { dict.setBigram(word, s.mWord, s.mProbabilityInfo); } } - if (!shortcuts.isEmpty()) shortcuts = new ArrayList<WeightedString>(); - if (!bigrams.isEmpty()) bigrams = new ArrayList<WeightedString>(); + if (!shortcuts.isEmpty()) shortcuts = new ArrayList<>(); + if (!bigrams.isEmpty()) bigrams = new ArrayList<>(); isNotAWord = false; for (String param : args) { final String params[] = param.split("=", 2); @@ -223,7 +223,7 @@ public class CombinedInputOutput { */ public static void writeDictionaryCombined( final Writer destination, final FusionDictionary dict) throws IOException { - final TreeSet<WordProperty> wordPropertiesInDict = new TreeSet<WordProperty>(); + final TreeSet<WordProperty> wordPropertiesInDict = new TreeSet<>(); for (final WordProperty wordProperty : dict) { // This for ordering by frequency, then by asciibetic order wordPropertiesInDict.add(wordProperty); diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java index 8e8ab19e0..37c8d4184 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java @@ -138,7 +138,7 @@ public class DictionaryMaker { } public Arguments(String[] argsArray) throws IOException { - final LinkedList<String> args = new LinkedList<String>(Arrays.asList(argsArray)); + final LinkedList<String> args = new LinkedList<>(Arrays.asList(argsArray)); if (args.isEmpty()) { displayHelp(); } diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java index cacee5268..8ae035f64 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java @@ -29,8 +29,7 @@ public class Dicttool { abstract public String getHelp(); abstract public void run() throws Exception; } - static HashMap<String, Class<? extends Command>> sCommands = - new HashMap<String, Class<? extends Command>>(); + static HashMap<String, Class<? extends Command>> sCommands = new HashMap<>(); static { CommandList.populate(); } diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java index cd3d4d393..94d1ae8bb 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java @@ -85,8 +85,7 @@ public class Diff extends Dicttool.Command { private static void diffHeaders(final FusionDictionary dict0, final FusionDictionary dict1) { boolean hasDifferences = false; - final HashMap<String, String> options1 = - new HashMap<String, String>(dict1.mOptions.mAttributes); + final HashMap<String, String> options1 = new HashMap<>(dict1.mOptions.mAttributes); for (final String optionKey : dict0.mOptions.mAttributes.keySet()) { if (!dict0.mOptions.mAttributes.get(optionKey).equals( dict1.mOptions.mAttributes.get(optionKey))) { diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java index 33661c8d6..b6383d788 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java @@ -53,8 +53,8 @@ public class Test extends Dicttool.Command { BinaryDictDecoderEncoderTests.class, BinaryDictEncoderFlattenTreeTests.class, }; - private ArrayList<Method> mAllTestMethods = new ArrayList<Method>(); - private ArrayList<String> mUsedTestMethods = new ArrayList<String>(); + private ArrayList<Method> mAllTestMethods = new ArrayList<>(); + private ArrayList<String> mUsedTestMethods = new ArrayList<>(); public Test() { for (final Class<?> c : sClassesToTest) { diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java index 17e77dca1..7435fa7d6 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java @@ -115,7 +115,7 @@ public class XmlDictInputOutput { } } } else if (ROOT_TAG.equals(localName)) { - final HashMap<String, String> attributes = new HashMap<String, String>(); + final HashMap<String, String> attributes = new HashMap<>(); for (int attrIndex = 0; attrIndex < attrs.getLength(); ++attrIndex) { final String attrName = attrs.getLocalName(attrIndex); attributes.put(attrName, attrs.getValue(attrIndex)); @@ -172,7 +172,7 @@ public class XmlDictInputOutput { DST_ATTRIBUTE = dstAttribute; DST_FREQ = dstFreq; mSrc = null; - mAssocMap = new HashMap<String, ArrayList<WeightedString>>(); + mAssocMap = new HashMap<>(); } @Override @@ -184,7 +184,7 @@ public class XmlDictInputOutput { int freq = getValueFromFreqString(attrs.getValue(uri, DST_FREQ)); WeightedString bigram = new WeightedString(dst, freq / XML_TO_MEMORY_RATIO); ArrayList<WeightedString> bigramList = mAssocMap.get(mSrc); - if (null == bigramList) bigramList = new ArrayList<WeightedString>(); + if (null == bigramList) bigramList = new ArrayList<>(); bigramList.add(bigram); mAssocMap.put(mSrc, bigramList); } @@ -352,7 +352,7 @@ public class XmlDictInputOutput { */ public static void writeDictionaryXml(Writer destination, FusionDictionary dict) throws IOException { - final TreeSet<WordProperty> wordPropertiesInDict = new TreeSet<WordProperty>(); + final TreeSet<WordProperty> wordPropertiesInDict = new TreeSet<>(); for (WordProperty wordProperty : dict) { wordPropertiesInDict.add(wordProperty); } |