LinkedList parameters in Java
I have created a program that contains linked lists that are passed in various ways. While this works fine in Java ... the style checker we should be using doesn't like
It says: Declaring variables, return values, or parameters of type 'LinkedList' is not allowed.
If I declare them as just a list, then I don't have access to the methods I want. What should I do?
a source to share
Declare it as Deque
(a different interface that it implements) or reconfigure your style checker. However, Deque
has some missing methods, not List
. Here's an excerpt from his Javadoc:
Unlike the interface
List
, this interface does not provide support for indexed element access.
But I don't expect you to use them :)
a source to share