Hey, this is pretty sweet. We should get this into GWT I think! On Wed, Feb 3, 2010 at 10:26 AM, Thomas Broyer <[email protected]> wrote:
> my JsCollections module: http://code.google.com/p/gwt-in-the-air/ > > http://code.google.com/p/gwt-in-the-air/source/browse/trunk/src/net/ltgt/gwt/jscollections/client/JsArrays.java > > My JsArrays::toArray/fromArray are very "low-level" but toArray() has > the advantage that you can iterate over it and it generates more > optimized code (for (var i=0,l=arr.length;i<l;i++) {...}) than an > Iterator (involves a new class and creating a new instance of it each > time you want to iterate). > fromArray() is meant to be used when wrapping 'native' JS code, when > you know the JsArray is immutable (or at least has a "fixed size", and/ > or you've been give a "private" copy); in this case it can be > considered safe to cast the JsArray to/from a Java array. The Java > array is to be considered immutable (in DevMode it'll be a copy anyway) > > -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
