Skip to content

Commit 6d71a29

Browse files
author
TheProgramSrc
committed
Change Log:
• Added getter methods to MemoryStorage
1 parent f788881 commit 6d71a29

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>xyz.theprogramsrc</groupId>
88
<artifactId>SuperCoreAPI</artifactId>
9-
<version>3.2.3</version>
9+
<version>3.2.4</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SuperCoreAPI</name>

src/main/java/xyz/theprogramsrc/supercoreapi/global/storage/memory/MemoryStorage.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import xyz.theprogramsrc.supercoreapi.SuperPlugin;
44

55
import java.util.LinkedHashMap;
6+
import java.util.LinkedHashSet;
67
import java.util.LinkedList;
78
import java.util.Map;
8-
import java.util.Set;
99
import java.util.function.BiConsumer;
1010

1111
public class MemoryStorage<OBJ> {
@@ -44,8 +44,16 @@ public void forEach(BiConsumer<String, OBJ> consumer){
4444
this.memory.forEach(consumer);
4545
}
4646

47-
public Set<Map.Entry<String,OBJ>> entrySet(){
48-
return this.memory.entrySet();
47+
public LinkedHashSet<Map.Entry<String,OBJ>> entrySet(){
48+
return new LinkedHashSet<>(this.memory.entrySet());
49+
}
50+
51+
public OBJ get(String key){
52+
return this.memory.get(key);
53+
}
54+
55+
public String fromValue(OBJ obj){
56+
return this.keys().stream().filter(k-> this.memory.get(k).equals(obj)).findFirst().orElse(null);
4957
}
5058

5159
public LinkedList<String> keys(){

0 commit comments

Comments
 (0)