cushon / issues-import

0 stars 0 forks source link

Use ArrayDeque instead of LinkedList or Stack #257

Closed cushon closed 10 years ago

cushon commented 10 years ago

Original issue created by joebowbeer@google.com on 2014-06-24 at 09:56 PM


Detect use of java.util.LinkedList and java.util.Stack.

Use of java.util.LinkedList should be discouraged. ArrayList is almost always a better choice than LinkedList. For queue-like behavior, ArrayDeque is the best choice.

Use of Stack, which is based on LinkedList, is best replaced by ArrayDeque.

This check should (1) locate instances of LinkedList and encourage replacing them with ArrayList or ArrayDeque, and (2) locate instances of Stack and encourage replacing them with ArrayDeque.

There are no negative cases.

cushon commented 10 years ago

Original comment posted by eaftan@google.com on 2014-08-22 at 05:09 PM


We agree, but this is more appropriate as a best practices suggestion, not an error. We'll file an internal bug for the best practices too and CC you.


Status: WontFix