diff --git a/Prototype/PrototypeFiles/FileCache.java b/Prototype/PrototypeFiles/FileCache.java new file mode 100644 index 0000000..8d07044 --- /dev/null +++ b/Prototype/PrototypeFiles/FileCache.java @@ -0,0 +1,23 @@ +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FileCache { + private final Map cache = new HashMap<>(); + + public FileCache() { + FileJava fileJava = new FileJava("DPPrototype", "23/07/2024", "1KB"); + FileC fileC = new FileC("Socket", "23/07/2024", "2KB"); + + cache.put("DPPrototype", fileJava ); + cache.put("Socket", fileC); + } + + public Files get(String key){ + return cache.get(key).clone(); + } + + public void put(List files) { + files.forEach(file -> cache.put(file.getFilename(), file)); + } +}