Skip to content

Commit

Permalink
Add FileCache - PrototypeRegistry (PrototypeFIles)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessandroFerrante committed Aug 1, 2024
1 parent faabb1f commit 224e471
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Prototype/PrototypeFiles/FileCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class FileCache {
private final Map<String, Files> 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) {
files.forEach(file -> cache.put(file.getFilename(), file));
}
}

0 comments on commit 224e471

Please sign in to comment.