When i try to iterate HashMap, the following error occurs.
java.lang.Error: java.lang.NoSuchFieldException: map
at java8.util.HMSpliterators.<clinit>(HMSpliterators.java:445)
at java8.util.Spliterators.spliterator(Spliterators.java:898)
at java8.util.stream.StreamSupport.stream(StreamSupport.java:269)
It was done in Galaxy Note 4 with Android 5.0.1.
I think it's pretty dangerous to use reflection there in that all the Android forks may have different implementations of HashMap and HashSet. It might be better to wrap HashSet by Map interface one more time even though it can cause performance degradation instead of using Unsafe operations so it can work on every JVM safely.
I know it's not easy to solve but I hope it get done :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
on Android (starting with streamsupport release 1.1.5) you absolutely have to set the system property "java8.util.Spliterators.assume.oracle.collections.impl" to "false".
This is mentioned in the readme and a few discussion posts here several times.
I don't get what you mean by "wrapping HashSet by Map interface"?
Note that the library has been tested successfully on API 15 up to API 22 on a couple of devices and AVDs. It works on all these Android versions.
Let me know if you have further questions or ideas for improvement.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "Bug reports" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
When i try to iterate HashMap, the following error occurs.
It was done in Galaxy Note 4 with Android 5.0.1.
I think it's pretty dangerous to use reflection there in that all the Android forks may have different implementations of HashMap and HashSet. It might be better to wrap HashSet by Map interface one more time even though it can cause performance degradation instead of using Unsafe operations so it can work on every JVM safely.
I know it's not easy to solve but I hope it get done :)
Hi,
on Android (starting with streamsupport release 1.1.5) you absolutely have to set the system property "java8.util.Spliterators.assume.oracle.collections.impl" to "false".
This is mentioned in the readme and a few discussion posts here several times.
I don't get what you mean by "wrapping HashSet by Map interface"?
Note that the library has been tested successfully on API 15 up to API 22 on a couple of devices and AVDs. It works on all these Android versions.
Let me know if you have further questions or ideas for improvement.
Please note that, beginning with release 1.3.1, the above information about the necessity of setting the
"java8.util.Spliterators.assume.oracle.collections.impl"
property on Android to "false" is obsolete now.
streamsupport-1.3.1 (and higher) can be used on Android without setting any special property.