projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename “friend Sone” to just “friend.”
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
data
/
ShellCache.java
diff --git
a/src/main/java/net/pterodactylus/sone/data/ShellCache.java
b/src/main/java/net/pterodactylus/sone/data/ShellCache.java
index
fd3d6bc
..
8c7e4df
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/data/ShellCache.java
+++ b/
src/main/java/net/pterodactylus/sone/data/ShellCache.java
@@
-63,15
+63,20
@@
public class ShellCache<T> {
* The ID of the object
* @param object
* The object to store
* The ID of the object
* @param object
* The object to store
+ * @return The real object, or the shell if there is no real object yet
*/
@SuppressWarnings("unchecked")
*/
@SuppressWarnings("unchecked")
- public
void
put(String id, T object) {
+ public
T
put(String id, T object) {
if (!(object instanceof Shell<?>)) {
objectCache.put(id, object);
shellCache.remove(id);
if (!(object instanceof Shell<?>)) {
objectCache.put(id, object);
shellCache.remove(id);
- } else {
- shellCache.put(id, (Shell<T>) object);
+ return object;
}
}
+ if (objectCache.containsKey(id)) {
+ return objectCache.get(id);
+ }
+ shellCache.put(id, (Shell<T>) object);
+ return object;
}
/**
}
/**