On Thursday, January 26, 2012 1:58:14 PM UTC+1, tanteanni wrote:
at the beginning of my gwt adventure i read somewhere that it is better to use concrete classes for interfaces like lists, because the gwt compiler must generate java script for every kind of list.Is this (still) true?
Only on GWT-RPC, and yes it's still true. If you say you're transferring SomeObject via RPC, GWT has to compile the code for every class it knows that extends SomeObject, so you can safely send and receive SomeOtherObject (provided "class SomeOtherObject extends SomeObject"). So if you say java.util.List, GWT will grab java.util.Collections.SingletonList, java.util.Collections.EmptyList, java.util.Collections.ImmutableList, java.util.Arrays.ArrayList, java.util.ArrayList, java.util.LinkedList, etc. whereas if you say java.util.ArrayList, it reduces the number of classes that you app has to know about.
You can safely use java.util.List everywhere else in your code, just not in your method declarations in your GWT-RPC interfaces.
BTW, AutoBeans and RequestFactory only allow java.util.List and java.util.Set (and java.util.Map for AutoBeans), not java.util.ArrayList, java.util.HashSet or java.util.HashMap for instance.
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/r9xdYYnFFEYJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment