eric.giese
unread,Jun 5, 2012, 3:26:58 AM6/5/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to guava-discuss
I have to defend Louis standpoint. I had created a collection library
once by myself, and I know it can be very tricky to achieve a
"perfect" implementation without large amounts of duplicate code or
overcomplex APIs (at least internally).
The most important design guideline for a commonly used API should be
a simple API, a bugfree implementation and reasonable performance. I
guess guava handles these priorities pretty well. A high performance
can be achieved later on, if needed.
I guess what guava in general might need is a package-internal
structure which roughly resembles ArrayList, but is more an
ArrayBuilder. In a lot of cases, first an ArrayList is created which
is later on used to create an Array. Internal Builders might help
there, to reuse data buffers when possible. I used these a lot to
prevent redundant copying when possible.
Without such a change, I guess my suggested optimization above is
rather senseless, since Iterables.toArray() first creates an ArrayList
and then calls toArray. So at least for the mutable sortedCopy
implementation, the improvement has no effect.