Autocomplete for generic types in Eclipse
Posted
by
AvrDragon
on Stack Overflow
See other posts from Stack Overflow
or by AvrDragon
Published on 2012-07-03T14:56:16Z
Indexed on
2012/07/03
15:15 UTC
Read the original article
Hit count: 205
"Refer to objects by their interfaces" is a good practise, as mentioned in Effective Java. So for example i prefer
List<String> al = new ArrayList<String>();
over
ArrayList<String> al = new ArrayList<String>();
in my code. One annoying thing is that if i type ArrayList<String> al = new
and then hit Ctrl+Space in Eclipse i get ArrayList<String>()
as propostal. But if i type List al = new and then hit Ctrl+Space i will get only propostal to define anonymous inner class, but not propostals such as new ArrayList<String>()
, what is 99% the case, or for example new Vector<String>()
. Is there any way to get the subclasses as propostals for generic types?
© Stack Overflow or respective owner