In general the compiler will select the most specific type it can - if you write
Map<String, Panel> map = new HashMap<String, Panel>();
it will change that to
HashMap<String, Panel> map = new HashMap<String, Panel>();
as it is clear that the object can only be a HashMap at that location. In other cases it may not be able to make that promotion, but there is no 'extra code' to convert from one to the other, as HashMap implements Map, and Map's methods may then be invoked on HashMap.
The one slight cost that could exist would be when the compiler attempts to turn instance methods into static methods, as to avoid the small cost for dynamic dispatch. It is worth noting that making this change throughout your codebase is unlikely to cause a significant size difference, as Widget has a HandlerManager, and HandlerManager has an EventBus, usually of type SimpleEventBus, which has a Map in it, where the actual value is a HashMap. Thus both classes are necessary (assuming you use any Widget or Widget subclass in your app), as is the ability to refer to a HashMap as a Map.
--
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/-/5RxtGrh7zhgJ.
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