]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/DictionaryInfo.java
Allocate ArrayList to right size from the start.
[Dictionary.git] / src / com / hughes / android / dictionary / DictionaryInfo.java
index 80a5a1816058ce3e58ece1f838b14aab40accea4..53a1f7debf0b6306aa4875a8817e02e08fe37c54 100644 (file)
@@ -57,7 +57,7 @@ public class DictionaryInfo implements Serializable {
     public long uncompressedBytes;
     public long zipBytes;
     public long creationMillis;
-    public final List<IndexInfo> indexInfos = new ArrayList<IndexInfo>();
+    public final ArrayList<IndexInfo> indexInfos = new ArrayList<IndexInfo>();
     public String dictInfo;
 
     public DictionaryInfo() {
@@ -91,6 +91,7 @@ public class DictionaryInfo implements Serializable {
         uncompressedBytes = Long.parseLong(fields[i++]);
         zipBytes = Long.parseLong(fields[i++]);
         final int size = Integer.parseInt(fields[i++]);
+        indexInfos.ensureCapacity(size);
         for (int j = 0; j < size; ++j) {
             indexInfos.add(new IndexInfo(fields, i));
             i += IndexInfo.NUM_CSV_FIELDS;