On Thursday, December 1, 2011 6:31:17 AM UTC-8, Mark Murphy (a Commons Guy) wrote: > > On Thu, Dec 1, 2011 at 9:15 AM, SL@maxis <[email protected]> wrote: > > Java format: > > > > ArrayAdapter(Context context, int textViewResourceId, List<T> objects) > > > > Is the above template like in C++ ? > > > More or less. >
Not really. The confusion between Java generics and C++ templates causes more trouble than it explains things. When you come right down to it, the only thing in common is the angle-bracket syntax. It's very misleading to say that Java generics are like C++ templates. For that matter, it's pretty misleading to say that anything in Java is like its counterpart in C++. In Java pointers are called "references" and behave very differently from C++ pointers or references. Garbage collection works differently from destructors. The memory model is different. And so on. > I have a 15-year Java book; I think there is no such thing in there. > > Correct. > Not only that, but almost nothing from 1996 Java applies today. You don't use 'Vector' or 'Hashmap' any more, you have Swing (well, not for Android), a new threading model, generics, 'assert', for:each, enums, ... OMG! The list is HUGE what's missing from a 15-year-old reference. So much that it is essentially useless for a budding Android programmer. > > I did a little search on net, but did not see documents explaining the > > above. > http://lmgtfy.com/?q=Java+tutorial You would know the terminology if you read the Java tutorial: http://docs.oracle.com/javase/tutorial/java/TOC.html http://en.wikipedia.org/wiki/Generics_in_Java > http://docs.oracle.com/javase/tutorial/java/generics/index.html > http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html > -- Lew -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

