-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Collections should override spliterator() #2029
Comments
This will absolutely be part of Guava as soon as we support Java 8, but I'm not sure there is much we can do until then? |
I found posts going back 1-2 years talking about adding Java8 support in the near future: http://www.reddit.com/r/java/comments/1y9e6t/ama_were_the_google_team_behind_guava_dagger/cfjd2qi and https://groups.google.com/forum/#!topic/guava-discuss/fEdrMyNa8tA Is there an open issue tracking this work? Is there a short-term workaround I can use in the meantime? |
I don't think so - the primary issue is Google internal? As it stands, for essentially all immutable collections, a good implementation is IntStream.range(0, collection.size()).mapToObj(collection.asList()::get) |
I don't understand the question.
This won't do because |
The Google internal Comment was a statement, not a question. I'm not certain the IMMUTABLE characteristic is actually used for anything? That should still be an adequate substitute for most use cases I can think of... |
It had a question mark after it... :)
Agreed. I thought that this was being used for parallelization but it looks like it is not. So for now I don't have a concrete use-case for this characteristic.
Okay, but it is worth noting that the only characteristic it adds over the default is |
(Note: This will break the public Guava GWT tests. We'll come back to fix them.) Fixes #2585, #2479, #2029, and probably various other issues :) Also relevant: #2591 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=138100073
Because Guava's collection classes (e.g.
ImmutableList
) do not overridespliterator()
they inherit the default implementation which has a characteristics ofSIZED
andSUBSIZED
. This means that they cannot be used for parallel processing with ForkJoin.Expected behavior:
Immutable*
should provide a more efficientspliterator()
implementation.The text was updated successfully, but these errors were encountered: