Message10163
In Jython 2.7, Java's Map instance, e.g. HashMap, its values() method returns a Non-Java type which will cause unexpected behavior. In old Jython 2.5, it is right. Details are in below:
Below is the behavior in Jython 2.7:
Jython 2.7.0+ (, May 18 2015, 14:16:04)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_51
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.util import HashMap
>>> HashMap().values().iterator()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'iterator'
>>> type(HashMap().values())
<type 'list'>
Below is the behavior in Jython 2.5
Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:48:36)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_51
>>> from java.util import HashMap
>>> m = HashMap()
>>> m.values()
[]
>>> m.values().iterator()
java.util.HashMap$ValueIterator@3d246ea3
>>> type(m.values())
<type 'java.util.HashMap$Values'> |
|
Date |
User |
Action |
Args |
2015-07-23 09:31:09 | kaneg | set | recipients:
+ kaneg |
2015-07-23 09:31:08 | kaneg | set | messageid: <1437643868.98.0.191905394116.issue2381@psf.upfronthosting.co.za> |
2015-07-23 09:31:08 | kaneg | link | issue2381 messages |
2015-07-23 09:31:08 | kaneg | create | |
|