Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java2dart: Map.entrySet() translates to getMapEntrySet() which returns a List (Iterable) instead of Set #12594

Closed
DartBot opened this issue Aug 21, 2013 · 1 comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue

Comments

@DartBot
Copy link

DartBot commented Aug 21, 2013

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) {

  • List<MapEntry> result = [];
    +Set<MapEntry> getMapEntrySet(Map m) {
  • Set<MapEntry> result = new Set();
       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

@iposva-google
Copy link
Contributor

Added Area-java2dart, Triaged labels.

@mit-mit mit-mit closed this as completed Sep 3, 2015
@kevmoo kevmoo added closed-not-planned Closed as we don't intend to take action on the reported issue and removed triaged labels Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

4 participants