From f3523f5679f80f40835712160b8ddfa688bace8e Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Tue, 10 Feb 2015 21:53:21 +0100 Subject: SONAR-6048 Use LinkedHashMap to make behavior more consistent --- .../org/sonar/batch/scan/filesystem/InputPathCache.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sonar-batch') diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java index 6270eda9cf2..41eda45c49a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java @@ -31,7 +31,7 @@ import javax.annotation.CheckForNull; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; /** @@ -40,9 +40,9 @@ import java.util.Map; */ public class InputPathCache implements BatchComponent { - private final Map> inputFileCache = new HashMap<>(); - private final Map> inputDirCache = new HashMap<>(); - private final Map> inputFileMetadataCache = new HashMap<>(); + private final Map> inputFileCache = new LinkedHashMap<>(); + private final Map> inputDirCache = new LinkedHashMap<>(); + private final Map> inputFileMetadataCache = new LinkedHashMap<>(); public Iterable allFiles() { return Iterables.concat(Iterables.transform(inputFileCache.values(), new Function, Collection>() { @@ -102,7 +102,7 @@ public class InputPathCache implements BatchComponent { public InputPathCache put(String moduleKey, InputFile inputFile) { if (!inputFileCache.containsKey(moduleKey)) { - inputFileCache.put(moduleKey, new HashMap()); + inputFileCache.put(moduleKey, new LinkedHashMap()); } inputFileCache.get(moduleKey).put(inputFile.relativePath(), inputFile); return this; @@ -110,7 +110,7 @@ public class InputPathCache implements BatchComponent { public synchronized InputPathCache put(String moduleKey, String relativePath, InputFileMetadata metadata) { if (!inputFileMetadataCache.containsKey(moduleKey)) { - inputFileMetadataCache.put(moduleKey, new HashMap()); + inputFileMetadataCache.put(moduleKey, new LinkedHashMap()); } inputFileMetadataCache.get(moduleKey).put(relativePath, metadata); return this; @@ -118,7 +118,7 @@ public class InputPathCache implements BatchComponent { public InputPathCache put(String moduleKey, InputDir inputDir) { if (!inputDirCache.containsKey(moduleKey)) { - inputDirCache.put(moduleKey, new HashMap()); + inputDirCache.put(moduleKey, new LinkedHashMap()); } inputDirCache.get(moduleKey).put(inputDir.relativePath(), inputDir); return this; -- cgit v1.2.3