Closed GoogleCodeExporter closed 9 years ago
r03
Original comment by kevinb@google.com
on 9 Apr 2010 at 5:41
The implementation of this copies the specified Iterable into a new ArrayList
twice--once for the sort, and then again to create a defensive copy when
creating the ImmutableList.
This seems wasteful because both classes making the copy are inside Guava.
There's no ideal way to improve this but two options are
1. Introduce package-private factory methods that bypass the defensive copying
2. Add a copyOf(Iterable, Ordering) method that will sort the array before
passing into construct().
I know this is low-priority but it can add up.
Original comment by ori.schw...@gmail.com
on 4 May 2012 at 9:40
I will investigate to see if there's actually a nonnegligible performance
improvement.
Original comment by wasserman.louis
on 4 May 2012 at 10:02
In Feb 2010 we actually did add a package-private ImmutableList.backedBy(E[])
method, but then we backed out of it. We never found more than one safe place
we could use it, and we caused bugs by using it unsafely. Part of the problem
might have been keeping track of who's responsible for the null checking? Dunno.
Original comment by kevinb@google.com
on 4 May 2012 at 10:14
Um. We currently have ImmutableList.asImmutableList(Object[]) already as
package-private. Sending in a CL to use it.
Original comment by wasserman.louis
on 7 May 2012 at 2:34
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:10
Original issue reported on code.google.com by
kevinb@google.com
on 12 Feb 2010 at 5:01