Muhammad Ali Khojaye wrote:In writing this way, if you later decide that instead of ArrayList, LinkedList would perform better in the application then you just have to change a single line of code and everything would still work correctly.
Also... if you want to use it in threaded fashion, you can "change a single line of code" to get it from Collections.synchronizedList(). Of course, in that case, you have to use the List interface, as the class files for the sychronization list wrappers are not in scope, out of the Collections class.
Henry