Forums Register Login

warning: unchecked call to add(E) as a member of the raw type java.util.List

+Pie Number of slices to send: Send
MacBookPro OSX v 10.4.11
javac 1.5.0_13
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing)

google java.util.List to get the javadocs and look at java.util.List for java 2 Platform standard edition 5.0

find the entry for the "add" method and expect to see that it is deprecated and a recommendation for the new, accepted method of adding to an ArrayList ... but I don't see anything like a warning or deprecation notice.

What am I missing?

Regards,

Gus

PS: I am very appreciative of the time, trouble and patience you folk exhibit around here with your less experienced companeros. Thanks a lot.
+Pie Number of slices to send: Send
This message is because you are not using generics with your List. Note that this is only a warning -- not an error. Your code should still compile and run.

MacBookPro OSX v 10.4.11


Nice!
+Pie Number of slices to send: Send
ArrayList<type of variable> list = new ArrayList<type of variable>()
this will fix it you need to mention which type of list it is
e.g

ArrayList<String> step = new ArrayList<String>()
step.add("abc");
step.add("cde");
+Pie Number of slices to send: Send
Sandeep, welcome to JavaRanch.

Please note that you are responding to a topic from 2007. The original poster is most likely not still waiting for an answer.
+Pie Number of slices to send: Send
I believe it is because you are not using generics in your code.
+Pie Number of slices to send: Send
 

Geoffrey Lews wrote:. . . you are not using generics . . .

That's correct. And welcome to the Ranch
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 36159 times.
Similar Threads
Could not start up the CDSA libraries
javac gives no type safety warning ?
JDK and Java2 Platform
Resolving most specific method
Servlets Container
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:25:35.