http://gwt-code-reviews.appspot.com/291801/diff/1/6 File bikeshed/src/com/google/gwt/collections/MutableArray.java (right):
http://gwt-code-reviews.appspot.com/291801/diff/1/6#newcode97 bikeshed/src/com/google/gwt/collections/MutableArray.java:97: E[] newElems = (E[]) new Object[oldLen + 1]; On 2010/03/30 19:56:49, Dan Rice wrote:
Inserts and removes still get faster because they no longer have to
allocate
(most of the time). They still have to copy, of course. Also,
removal of the
last element is a not uncommon thing to do (consider implementing a
stack using
a list).
Certainly. Actually may be that is an issue. This implementation is one of an array. But the presence of an add() method can give the impression of providing some list semantics. In reality it provides a poor list behavior. But on the other hand the JSNI add implementation will have different costs. Add is fairly cheap in Javascript, isn't it?
A more standard name for grow() would be setCapacity().
... and it would truncate if the size is smaller. Sounds good to me. http://gwt-code-reviews.appspot.com/291801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors To unsubscribe from this group, send email to google-web-toolkit-contributors+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
