I just learned that Eclipse can automatically create (or suggest) variable names for you. The suggestions are based on the class of the object you're about to create, and any characters you've typed for the variable name so far.
For example, if I'm in a method and I type Connection
, followed by a space, then press the [Control][Space] keys, Eclipse adds a variable named connection
, so my line changes to Connection connection
.
This feature gets even more interesting if you type one or two characters of the variable name, then press [Control][Space]. For example, if you type StringBuffer s
, then press [Control][Spacebar], Eclipse gives you a drop-down menu with choices of stringBuffer
and sBuffer
, which is pretty cool.
As I've described in other blog postings, this same [Control][Space] keystroke provides a number of suggestions in Eclipse, generally falling into a category named content assist. Whatever you call it, I like it, because it saves me a lot of time and keystrokes.