java - How avoids SonarQube major issues, while using LinkedList method? -
I wonder how I can avoid the SonQuebeck issue:
Announcements to Java The archive interface should be used as a "list" rather than special implementation classes such as "linkedlist"
, so I want to use the specific method of linkedlist in this way:
LinkedList & lt; String & gt; Item = new linked list & lt; String & gt; (); // add someitems string elem = items.removeFirst ();
The only solution I have to get is to convert to Qi, but then I have to use the methods of the interface:
qi < String & gt; Item = new linked list & lt; String & gt; (); // add someitems string elem = items.poll ();
I can remove the object before using this method. Is there any other solution?
In this case, the method must be used to recommend this method, As mentioned in the javadoc of: removeFirst
comes from the interface and this is the interface you should use instead of working directly with the implementation.
Comments
Post a Comment