| Issue 695: | ArrayList toArray(SomeClass[]) should be implemented | |
| 5 people starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
Found in GWT Release: 1.3 Detailed description: The toArray(SomeClass[]) method is not implemented in GWT's ArrayList. At the very least the documentation should clearly state that the method is not available because it is a widely used method on java.util.ArrayList. Workaround if you have one: Write your own implementation of static MyClass[] toArray(List/*<MyClass>*/ list) for each class you need to do this for. Links to the relevant GWT Developer Forum posts: http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f46ac6677ffa85c0/a9d911421f528778?lnk=gst&q=toArray&rnum=1#a9d911421f528778 |
||||||||||||||||||
,
Feb 15, 2007
(No comment was entered for this change.)
Cc: gwt.team.hcc
Labels: Category-JRE |
|||||||||||||||||||
,
Apr 29, 2007
This method is nice for eliminating casting and copying, e.g.
HasFocus[] result = new HasFocus[list.size()];
list.toArray(result);
foo(result);
vs
HasFocus[] result = new HasFocus[list.size()];
Object[] temp = list.toArray();
for (int i; i < result.length; i++)
{
result[i] = (HasFocus) temp[i];
}
foo(result);
I realize that without refelection you cannot auto-expand the array parameter's size.
But even a minimal implementation which throws an IndexOutOfBoundsException would
save a lot of user code. (I wonder if you really need reflection. How are arrays
implemented in GWT? Could JSNI be used to expand the size of the array param?)
|
|||||||||||||||||||
,
Jul 19, 2007
+100 for this one. I tried to use toArray( Range[ result.size() ] ) but the compiler fails to run in this case. If I just use toArray() then in the browser it works but the Hosted mode fails because of a ClassCastException. Using GWT.isScript does not help unfortunately. |
|||||||||||||||||||
,
Jul 19, 2007
This kind of fell off the radar.
Owner: gwt.team.jgw
Cc: -gwt.team.hcc gwt.team.scottb Labels: -Type-Defect Type-Enhancement |
|||||||||||||||||||
,
Aug 03, 2007
Committed as r1270.
Status: FixedNotReleased
Owner: gwt.team.scottb Cc: -gwt.team.scottb gwt.team.knorton Labels: Milestone-1_4_RC2 ReviewBy-knorton |
|||||||||||||||||||
,
Aug 20, 2007
1.4 RC2 now released.
Status: Fixed
|
|||||||||||||||||||
,
Feb 25, 2008
When inspecting the JClassType of the interface java.util.List it does not have a JMethod for the interfaces method "toArray(Object[])". Should this not be available? I'm writing a generator that creates a class that implements java.util.List, I loop through all the methods, however the generated class fails to compile indicating: The type ListWrapper must implement the inherited abstract method Collection.toArray (Object[]) |
|||||||||||||||||||
|
,
Apr 28, 2008
Owner: scottb
|
|||||||||||||||||||
|
,
Apr 29, 2008
|
|||||||||||||||||||
|
,
Apr 29, 2008
|
|||||||||||||||||||
|
,
Apr 29, 2008
Cc: -gwt.team.knorton knor...@google.com
|
|||||||||||||||||||
|
|
|||||||||||||||||||