import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
/**
*/
public class InputPathCache implements BatchComponent {
- private final Map<String, Map<String, InputFile>> inputFileCache = new HashMap<>();
- private final Map<String, Map<String, InputDir>> inputDirCache = new HashMap<>();
- private final Map<String, Map<String, InputFileMetadata>> inputFileMetadataCache = new HashMap<>();
+ private final Map<String, Map<String, InputFile>> inputFileCache = new LinkedHashMap<>();
+ private final Map<String, Map<String, InputDir>> inputDirCache = new LinkedHashMap<>();
+ private final Map<String, Map<String, InputFileMetadata>> inputFileMetadataCache = new LinkedHashMap<>();
public Iterable<InputFile> allFiles() {
return Iterables.concat(Iterables.transform(inputFileCache.values(), new Function<Map<String, InputFile>, Collection<InputFile>>() {
public InputPathCache put(String moduleKey, InputFile inputFile) {
if (!inputFileCache.containsKey(moduleKey)) {
- inputFileCache.put(moduleKey, new HashMap<String, InputFile>());
+ inputFileCache.put(moduleKey, new LinkedHashMap<String, InputFile>());
}
inputFileCache.get(moduleKey).put(inputFile.relativePath(), inputFile);
return this;
public synchronized InputPathCache put(String moduleKey, String relativePath, InputFileMetadata metadata) {
if (!inputFileMetadataCache.containsKey(moduleKey)) {
- inputFileMetadataCache.put(moduleKey, new HashMap<String, InputFileMetadata>());
+ inputFileMetadataCache.put(moduleKey, new LinkedHashMap<String, InputFileMetadata>());
}
inputFileMetadataCache.get(moduleKey).put(relativePath, metadata);
return this;
public InputPathCache put(String moduleKey, InputDir inputDir) {
if (!inputDirCache.containsKey(moduleKey)) {
- inputDirCache.put(moduleKey, new HashMap<String, InputDir>());
+ inputDirCache.put(moduleKey, new LinkedHashMap<String, InputDir>());
}
inputDirCache.get(moduleKey).put(inputDir.relativePath(), inputDir);
return this;