A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Node.js in Action
this week in the
Programmer Certification (SCJP/OCPJP)
Warning in adding to a Collection
Joined: Jan 24, 2007
Nov 26, 2007 07:54:00
in what situation, adding to a Collection generates a warning, but compile fine?
I don't remember it and I can't found where I readed it?
Please help me I'm trying to fix errors ragarding generics concepts.
Objective: SCJP 1.5<br /><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html" target="_blank" rel="nofollow">API</a><br /> <blockquote><font size="1" face="Verdana, Arial">code:</font><hr><pre><font size="2"><br />Double n1 = Double.NaN; Double n2 = Double.NaN;<br /> n1.equals(n2) // true even though Double.NaN != Double.NaN<br />-0.0 == +0.0; // true<br />Double n1 = -0.0;Double n2 = +0.0;<br />n1.equals(n2) // false even though -0.0 == +0.0<br /></font></pre><hr></blockquote>
Joined: Feb 07, 2005
Nov 26, 2007 09:06:00
If you try to add to a raw Collection, you will usually get a warning.
I agree. Here's the link:
subject: Warning in adding to a Collection
non-generic collection always compiles with warning ?
Reading ID3 Tags of MP3s
Doubt i a generics question
Type inferrence generic method.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014