Short answer: no, there is no functional difference, except for the extra unnecessary memory overhead for saving this additional lock object. However, there are several semantics-related elements that I would like to consider before making a final decision.
Will I ever have to perform synchronized operations more than just my internal list?
Suppose you wanted to keep a parallel data structure for your ArrayList so that all operations in the list and parallel data structure needed to be synchronized. In this case, it would be better to use external locking, since locking in a list or structure can confuse future developments in this class.
Will I provide access to my list outside my queue class?
Suppose you want to provide an access method for your list or make it visible to extensions of your Queue class. If you used an external lock object, classes that received links in the list will never be able to perform thread-safe operations on this list. In this case, it would be better to synchronize in the list and explain in the API that external accesses / modifications in the list should also be synchronized in this list.
I am sure there are more reasons why you can choose one of them, but these are two big ones that I can think of.
source share