[QUOTE=Monstre]
Another possible approach – if knowledge of Java collection data structures is desired – just ask the interviewee to describe their understanding of the general set-up behind the collections framework (interfaces, implementations, algorithms).
[/QUOTE]
I’d say this is better. It’s specific to Java and doesn’t require knowledge of one specific collection type. I’d say any candidate who can answer the ‘revised’ question would be able to use a HashMap if the situation required it. Plus, it lets you get a feel for how in-depth a person’s knowledge is. (similar to the pass by value/reference question)
I’d consider it more important for someone to understand how java collections are setup than someone to know “You can’t instantiate a map, but you can instantiate a HashMap”. Or that one is an interface and one is an implementation of that interface without knowing why an interface is used.
Of course, this is advice if you’re looking for a developer-type person…If you’re just looking for a code-monkey, then asking the question the other way is appropriate.
Might I suggest a question about testing? Find out whether or not the person considers tests important, and if they’ve used one of the xUnit (JUnit or otherwise) frameworks for writing them. I’ve run into some talented developers who don’t believe in unit testing, but the code they write is generally of a lower quality than someone who does test but isn’t as skilled. If your company doesn’t do any kind of automated testing then, while I’d question your sanity, this probably isn’t worth asking.
This isn’t really a java-specific thing, so it won’t help in figuring out if the candidate knows java, but it will speak to the quality of code you can expect if you hire them.