Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Difficult interview question?

896392Oct 26 2011 — edited Oct 31 2011
Like many tech companies, my company has a lot of open positions and I'm involved in the interview process. My coworkers believe that one of the questions I ask is too difficult and that I'm being too hard on candidates, but I'm not sure that's the case. So I was hoping to run the question by experienced developers here to get more opinions.

What I ask is basically to implement the following class:
public class CompoundIterator<T> implements Iterator<T> {

    public CompoundIterator(Iterator<T>... items) {

    }

}
The basic requirement is that it be able to coalesce multiple Iterators into a single Iterator. There are multiple ways of solving this (read all items into a List in the constructor and delegate the iterator() call, save the Iterators in the constructor and return an anonymous Iterator implementation, etc), so I'm not necessarily looking for a specific solution, though I'd prefer the candidate to ask questions about the desired behavior and pick the best implementation based on my answers. But what I'm finding is that people who claim to have 10+ years of experience developing Java are unable to even formulate clarifying questions, let alone come up with a solution.

So...what do people think...is this an overly difficult question that will disqualify quality candidates or is Iterator important enough and the problem easy enough that any Java developer worth hiring should be able to, at a minimum, figure out some solution?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 28 2011
Added on Oct 26 2011
12 comments
499 views