java - List versus ArrayList -
this question has answer here:
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
Post a Comment