In Intellij, how can I get a List on the left hand side when I extract a variable that's an ArrayList?
Posted
by
tieTYT
on Stack Overflow
See other posts from Stack Overflow
or by tieTYT
Published on 2014-08-18T21:37:31Z
Indexed on
2014/08/18
22:20 UTC
Read the original article
Hit count: 285
As an example, if I extract a variable from this:
return new ArrayList<CrudTestData<Foo>>();
It will turn the code into this:
ArrayList<CrudTestData<Foo>> list = new ArrayList<CrudTestData<Foo>>();
return list;
How can I automatically get a list on the left hand side like this?
List<CrudTestData<Foo>> list = new ArrayList<CrudTestData<Foo>>();
return list;
Theoretically, Intellij should know to use a List
instead of a Collection
because the method returns a List
.
© Stack Overflow or respective owner