java2dart: Map.entrySet() translates to getMapEntrySet() which returns a List (Iterable) instead of Set #12594
Labels
closed-not-planned
Closed as we don't intend to take action on the reported issue
This issue was originally filed by @hpoul
When calling .toEntries on a java Map and translating it to dart it will be translated to a call to getMapEntrySet of java_core.dart
i think getMapEntrySet should return a Set instead of a List/Iterable to be compatible with the java apis - simply changing the code to use Set instead of List worked for me:
Index: resources/java_core.dart
===================================================================
--- resources/java_core.dart (revision 26423)
+++ resources/java_core.dart (working copy)
@@ -466,8 +466,8 @@
}
}
-Iterable<MapEntry> getMapEntrySet(Map m) {
+Set<MapEntry> getMapEntrySet(Map m) {
m.forEach((k, v) {
result.add(new MapEntry(m, k, v));
});
return result;
}
(It's just a problem because my existing java code already works with "Set" which raises exceptions when running in dart's checked mode.. if there is a reason for this inconsistency, it shouldn't be too hard to recode my java code to use Iterable's.)
What version of the product are you using? On what operating system?
rev. 26096
The text was updated successfully, but these errors were encountered: