-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
The following does not work:
java.util.Map<String, Integer> javaMap = new java.util.HashMap<String, Integer>();
Map<String, Integer> immutableMap = Maps.copyOf(javaMap.entrySet());Compile error:
build/plugins/java/Dexx.java:20: error: no suitable method found for copyOf(java.util.Map<String,Integer>)
Map<String, Integer> immutableMap = Maps.copyOf(javaMap);
^
method Maps.<K#1,V#1>copyOf(Iterable<Pair<K#1,V#1>>) is not applicable
(cannot infer type-variable(s) K#1,V#1
(argument mismatch; java.util.Map<String,Integer> cannot be converted to Iterable<Pair<K#1,V#1>>))
method Maps.<K#2,V#2>copyOf(Iterator<Pair<K#2,V#2>>) is not applicable
(cannot infer type-variable(s) K#2,V#2
(argument mismatch; java.util.Map<String,Integer> cannot be converted to Iterator<Pair<K#2,V#2>>))
method Maps.<K#3,V#3>copyOf(Pair<K#3,V#3>[]) is not applicable
(cannot infer type-variable(s) K#3,V#3
(argument mismatch; java.util.Map<String,Integer> cannot be converted to Pair<K#3,V#3>[]))
where K#1,V#1,K#2,V#2,K#3,V#3 are type-variables:
K#1 extends Object declared in method <K#1,V#1>copyOf(Iterable<Pair<K#1,V#1>>)
V#1 extends Object declared in method <K#1,V#1>copyOf(Iterable<Pair<K#1,V#1>>)
K#2 extends Object declared in method <K#2,V#2>copyOf(Iterator<Pair<K#2,V#2>>)
V#2 extends Object declared in method <K#2,V#2>copyOf(Iterator<Pair<K#2,V#2>>)
K#3 extends Object declared in method <K#3,V#3>copyOf(Pair<K#3,V#3>[])
V#3 extends Object declared in method <K#3,V#3>copyOf(Pair<K#3,V#3>[])
It would be nice to have a method in Maps that allows to construct a Map from a java.util.Map
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels