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?