This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Linked Lists (Java Collections framework)  RSS feed

 
Asa Fernando
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I write a simple java program to add elements to the java.util.LinkedList; class using add(0,i1) I get the following warning.

C:\Asanak\Project>javac -Xlint:unchecked Test1.java
Test1.java:12: warning: [unchecked] unchecked call to add(int,E) as a member of
the raw type java.util.LinkedList
l1.add(0,i1);
^
1 warning

Can someone pls help me out. Thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

You're using a Java 5 compiler, and Java 5 has generics. Basically, Java now lets you specify what kind of objects that LinkedList can hold, and the warning is telling you that you're not taking advantage of that feature. Read the article for more info.

By the way, I deleted a copy of this message from the Java in General (Intermediate) forum. For an explanation, please read this.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!