The code below shows the use of List interface in existing code.
LinkedList<Song> playList = new LinkedList<Song>();
List was applied:
List<Song> playList = new LinkedList<Song>();
Then LinkedList was changed to ArrayList:
List<Song> playList = new ArrayList<Song>();
And after these two edits, the codes worked exactly as before. It was actually for a media player with features (methods)like play, skip forward, skip backwards and replay. Hence the prior need to use LinkedList for the songs.
I have a limited understanding of both LinkedList and ArrayList. I know they are implementations of List interface (hence they are both bound by the methods dictated by the List interface).
However, does that mean that once I use a List interface it matters not whether I initialise the code with ArrayList or LinkedList? Do the LinkedList and ArrayList become indistinguishable placeholders?
Or are there specific differences in the instances by LinkedList and ArrayList when both are referenced by List interface?