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

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -