-
Notifications
You must be signed in to change notification settings - Fork 863
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
fix #839 Iterable Java Object #846
Conversation
It seems like this is useful. Is it possible to update the commit message or this PR with a short sample of what is possible now that wasn't possible before so that we can put something in the release notes? Also, how do we ensure that some existing code won't break now that iteration is easier on many types of Java objects? |
Can I write the release notes here?
Since var l = new java.util.ArrayList([1, 2, 3]);
for (var v of l) print(v);
// js: uncaught JavaScript runtime exception: TypeError: [1.0, 2, 3] is not iterable I don't think there are any side effects from this becoming iterable. |
Thanks -- you have given me enough to put in the release notes when it's time. I might ask for help with the PR at that time if it's not obvious. It's cool that we're starting to use lambdas to cut down on code clutter too! |
@p-bakker Can this get added to the 1.7.14 milestone and properly linked to 839? |
I've linked the PR to the issue. As the issue is already linked to the milestone, i haven't linked the PR, because otherwise both the issue and the PR show up in the milestone |
Closes #839
Implemented
Symbol.iterator
injava.lang.Iterable
andjava.util.Map
.java.util.Iterator
is equivalent to the Iterator object in ECMAScript because it has state, so we did not implementSymbol.iterator
.java.util.Map
can iterate over keys and values just like ECMAScript'sMap
. Nashorn works the same way.