arraylist - Java list default implementation? -
arraylist - Java list default implementation? -
if declare new list this:
list<string> listexample = somefunction();
what list interface implementation used?
edit: answers far. considered clean way this, should declare list new?
as eran commented totally depends on somefunction();
returns .both arraylist<e>
, linkedlist implements list interface .
you can seek ,
system.out.println("" + listexample.getclass());
to find out has been implemented. docs
,
public final class<?> getclass()
returns runtime class of object. returned class object object locked static synchronized methods of represented class.
java arraylist
Comments
Post a Comment