POV-Ray : Newsgroups : povray.off-topic : A tale of two cities : Re: A tale of two cities Server Time
29 Jul 2024 06:18:01 EDT (-0400)
  Re: A tale of two cities  
From: Invisible
Date: 13 Mar 2012 11:46:11
Message: <4f5f6bc3$1@news.povray.org>
On 13/03/2012 03:15 PM, Invisible wrote:
> I keep hearing that Java has added generics since I last worked with it.
> I find it amusing that we can now write HashMap<Foo, Bar>, and yet we
> have type signatures like
>
> public Object get(Object key);
>
> Really? I mean, really? Should that not be
>
> public V get(K key);
>
> or similar? Is that not the entire /point/ of generics?

Interesting fact: It seems the latest JDK implements /two/ versions of 
the same interface.

public interface Iterator
{
   public boolean hasNext();
   public Object next();
   public void remove();
}

public interface Iterator<E>
{
   public boolean hasNext();
   public E next();
   public void remove();
}

If you accidentally forget to mention the element type, you get the old 
version of the interface, with all its type unsafety. Isn't that great? 
*sigh*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.