Using Auto-Complete (Code Assist)

Code Assist in action

One thing most people like about IDEs is the availability of extra language help when needed. Microsoft Visual Studio has a famous feature called IntelliSense. Eclipse has a similar built in feature called "Code Assist" which I find very useful. Code Assist is triggered automatically in a number of situations (for example, typing the "." after a variable name or class name). However, it can also be forced at any time using Ctrl-Space (remember Mac users, this shortcut doesn't change on a Mac). Code Assist has many uses. I'll go into a few of them.

Using Code Assist to examine possible completions

Say you are tapping away at the keyboard and all of a sudden you can't remember which of the many variables in your current scope you want to use in a particular expression. Suppose you're writing an if() statement and you need a variable to use in the condition expression. Hit Ctrl-Space and up pops a list of all things that you could possibly use, namely local variables, class data fields, class methods, static imports, etc.

Using Code Assist to examine a class's public interface

Now let's imagine that we have this complex object (...System for instance?), and we want to call one of its methods. But which one was it? System, as I'm sure you guys know, is EXTREMELY complex. Ah, but tap Ctrl-Space and up pops a list of all of the public methods you can call. Well crap. That's still a ton of methods! Now what? Code Assist responds to your typing, so as you type, the list of options grows smaller. For instance, if you type "get" the list will shrink to include only methods of the form getX(...). You get the idea.

Using Code Assist to examine Javadoc information

Another handy thing about Code Assist is that it will display any available JavaDoc info for the currently selected item in the drop-down list. This can be very useful when trying to decide what method to use, which object implementation to go with, or just simply to learn more about an object you're using. For those of you unfamiliar with JavaDoc, this means that all of the information in the online Java API (which is generated from JavaDoc comments) is available at your fingertips without even switching programs.

Anyway, that gives you a pretty good idea of what you can do with Code Assist. Now go experiment.