-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40451f1
commit 0eb0550
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/main/java/com/faforever/moderatorclient/ui/AvatarCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.faforever.moderatorclient.ui; | ||
|
||
import javafx.scene.image.Image; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class AvatarCache { | ||
|
||
private final Map<String, Image> cache; | ||
|
||
private static AvatarCache singleton; | ||
|
||
private AvatarCache() { | ||
this.cache = new HashMap<>(); | ||
} | ||
|
||
public static synchronized AvatarCache getInstance() { | ||
if (singleton == null) { | ||
singleton = new AvatarCache(); | ||
} | ||
return singleton; | ||
} | ||
|
||
public Image get(String key) { | ||
return this.cache.get(key); | ||
} | ||
|
||
public boolean containsKey(String key) { | ||
return this.cache.containsKey(key); | ||
} | ||
|
||
public void put(String cacheKey, Image img) { | ||
this.cache.put(cacheKey, img); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters