Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Gus Spier
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Sandeep Nimmakuri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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");
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic