Closed GoogleCodeExporter closed 9 years ago
Given that the randomaccess interface explicitly states that indexed iteration
should be faster there should be no downside in this change, instead it follows
closely the recommendations given there.
I know that there are implementations like persistent vectors which have a
constant time indexed access but might be faster to iterate via an iterator.
But these should not implement this interface IMHO. Also none of these
datastructures is common in java, given the complete absence of persistent
collections in the core library.
Original comment by Eric6i...@googlemail.com
on 1 Nov 2013 at 8:22
I'm not quite clear on what this is referring to, but I don't see any sense in
which this issue could be unresolved. ImmutableList.toArray() delegates to
ImmutableList.copyIntoArray, which does an indexed iteration rather than using
an Iterator. (And RegularImmutableList does a System.arraycopy, which is even
better.)
Original comment by lowas...@google.com
on 24 Sep 2014 at 6:30
Not sure if it's worth it, but I may know what's it all about:
ImmutableList.copyOf(Lists.transform(input, function))
works perfectly while (for the same input)
FluentIterable.from(input).transform(function).toList()
calls
ImmutableCollection.ensureCapacity(5)
ImmutableCollection.ensureCapacity(8)
ImmutableCollection.ensureCapacity(12)
ImmutableCollection.ensureCapacity(18)
though it could know better.
Original comment by Maaarti...@gmail.com
on 25 Sep 2014 at 5:42
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<issue id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:12
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
cpov...@google.com
on 16 Oct 2013 at 4:42