cgbusch wrote:
>>>Map m=(Map)list.get(0);
>>
>>Right now compiler complains here because it tries to tell you that you're
>>trying to do something potentially dangerous and wants you to make clear
>>that you *really* want to do it 
>
> Then I could do it via (implicit), like so:
> Map m=(implicit)list.get(0);
> But if it was so potentially dangerous, then why are we forced to do it so often?
Because a lot of these methods are defined as returning Object in order
to be as general as possible. It's up to the programmer to know what
kind of objects got stuffed into the collection and cast accordingly.
The JVM will very helpfully throw a runtime ClassCastException if you
get it wrong. Then again, you could always use instanceof in order to
determine whether what you were expecting is what you actually have.