[gameprogrammer] Re: What do I need to download develop a client/server java applet?

On Fri, 22 Jul 2005 12:17:59 -0600, "Scott Harper" <lareon@xxxxxxxxxxx>
said:
> 
> On 21 Jul, 2005, at 5:56 PM, Fernando Arturo Gómez Flores wrote:
> > Java does not support generic programming (and don't say that Java  
> > does generic programming through that 'object' thing since this is 
> > not true).
> 
> I'm not sure how this is true (java does not support generic  
> programming).
>
> ArrayList<String> myList = new ArrayList<String>();

The way Java does this is basically using syntactic sugar.  As I
understand it, Java doesn't really generate separate code for different
template instantiations, it just cast everything to and from Object, but
doesn't make you do the casts yourself.  This isn't quite the same as
C++'s full template metaprogramming support.

When combined with auto-boxing of primitives into classes:

Old:

List l = new Vector();
l.add(new Double(1.0));
double d = ((Double)l.get(0)).doubleValue();

New (with syntactic sugar):

List<Double> l = new Vector<Double>();
l.add(1.0);
double d = l.get(0);

Dave.
-- 
  Dave Slutzkin
  Melbourne, Australia
  daveslutzkin@xxxxxxxxxxx



---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: