Skip to content

Commit 4ec8215

Browse files
committed
compiler: add CollectionsUtil#mapOf() for creating an empty map
1 parent 52b4a47 commit 4ec8215

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/util/CollectionsUtil.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ public static <K, V> Map<K, V> mapOfEntries(Map.Entry<K, V>... entries) {
6767
return Collections.unmodifiableMap(newMap);
6868
}
6969

70+
/**
71+
* Creates an unmodifiable empty map.
72+
*
73+
* @param <K> the key type
74+
* @param <V> the value type
75+
* @return an unmodifiable empty map
76+
*/
77+
public static <K, V> Map<K, V> mapOf() {
78+
return Collections.emptyMap();
79+
}
80+
7081
/**
7182
* Creates an unmodifiable map with a single entry.
7283
*

0 commit comments

Comments
 (0)