java - List versus ArrayList -


which 1 better , why ?

a) list<string> list = new arraylist<>();

b) arraylist<string> list = new arraylist<>();

it depends on context.

if care list semantics , not particular implementation, go list<string>. if want enforce particular implementation, go arraylist<string>, linkedlist<string> or else.

in cases, want go on interface , not particular implementation.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -