Mahendra Athneria wrote:
how to fix that error?
It's not an error, it's a piece of advice -- and in this case, it's bad advice, since you're actually using the richer interface of LinkedList. I haven't used Sonar personally, but hopefully it has some way to turn off this warning for this line -- with a setting somewhere, or possibly using an annotation in the source (ugh).
Anyway, feel free to ignore it. This is a case where automatic style checking just makes more work (in fact,
most of the time, automatic style checking just makes more work, but that's another discussion.)