From f58df741e314b5fb09218283c07e79ce6d84ba1f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Reimar=20D=C3=B6ffinger?= Date: Sat, 24 Jun 2017 15:26:56 +0200 Subject: [PATCH] Allocate ArrayList to right size from the start. --- src/com/hughes/android/dictionary/DictionaryInfo.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/hughes/android/dictionary/DictionaryInfo.java b/src/com/hughes/android/dictionary/DictionaryInfo.java index 80a5a18..53a1f7d 100644 --- a/src/com/hughes/android/dictionary/DictionaryInfo.java +++ b/src/com/hughes/android/dictionary/DictionaryInfo.java @@ -57,7 +57,7 @@ public class DictionaryInfo implements Serializable { public long uncompressedBytes; public long zipBytes; public long creationMillis; - public final List indexInfos = new ArrayList(); + public final ArrayList indexInfos = new ArrayList(); 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; -- 2.43.0