I attended a in-person interview recently and performed well. But surprisingly I got rejected. When I asked the HR for reason, he contacted the technical interviewer and told me that I was syntactically wrong while coding.

I used Google Guava for coding. So my code looked like this:

List<String> items = Lists.newArrayList()

instead of

List<String> items =new ArrayList<String>();

I know that the code will compile and work as expected.Is it ok to use third party libraries like Google Guava in interviews?

  • 21
    I would read your version as "This person doesn't even know how to construct a list of strings" if I were interviewing you because I have 0 familiarity with "Google Guava". I wouldn't say don't do this in the future so much as, ask before doing odd things in an interview. The interviewer might take it as a plus that you know this thing if they know it too, or as was this case, they might think you're just scrawling gibberish because they don't know any better. Oct 8, 2012 at 18:32
  • 1
    I've got some bad news for you. One of two things is true. Either the company actually rejected you over this issue, in which case they're morons you don't want to work with, or this was far from the only concern they had about you in your interview. Jan 18, 2013 at 15:00

3 Answers 3


If you are doing something, non-standard at an interview - ask. Or at least say you are using Guava.

I do ask a simple Java question early in an interview. I usually tell candidates they can assume anything they want so long as they tell me what it is. In a simple question like this, if the candidate asked to use Guice, I'd probably say not to - just use core Java. I need to know candidates know core Java.

What happens if the interviewer doesn't know the library you chose or it isn't available at the company? (Not everything open source can be used at every company.)

Try to avoid being clever at interviews. Too many "Java developers" don't know how to write Java. The interviewer has to assume incompetence before cleverness.


You say,

I know that the code will compile and work as expected.

... but as you've learned, it won't... because you didn't confirm that the correct version is available at build time, on the build machine(s).

That's not the point though. The point, and the root cause of your not getting hired, is that you failed to communicate with the interviewer. You didn't communicate a requirement or dependency for the code you were writing. Personally, I would consider that a large assumption (dependency management can be a pretty big deal that involves static analysis, code reviews, dev training, build, the installer/deployment, legal, SLAs, etc).

So now you know, and knowing is half the battle. But that doesn't really help. What does is a big tip that I got when doing interviews:

For every line you write on the whiteboard, say something relevant.

Start with these as you're writing each line:

  • "I'm thinking that ..."
  • "This makes sense because... "
  • "This assumes that... "

In your scenario, I would have said something along the lines of:

"I'm thinking that a simple list of strings should suffice, so I'll just pull one out of Guava."

... or even

"Is it safe to assume that the Guava libraries are available?"

As a point of interest, I write .NET/C# and I asked in an interview at Microsoft if it was safe to assume that I could use LINQ. The answer was no.

  • Off topic, what did they want you to use instead of LINQ? Oct 8, 2012 at 19:34
  • @JeanneBoyarsky: The particular questions I was being asked were designed to gauge more imperative programming skills/techniques than declarative or functional. Oct 8, 2012 at 20:04
  • 1
    +1 for asking. As a point of interest, when I interviewed at Google I asked if I could use Guava and my interviewer was OK with it. YMMV of course. Oct 9, 2012 at 1:27
  • 1
    @DanielPryden: Absolutely, but the question appeared too easy with LINQ, which is what prompted my asking. Later in the interview (process... different person), they were perfectly fine with my using LINQ. I asked again because it didn't seem like it was the crux of the issue that we were discussing and it made the code cleaner/shorter to write. Oct 9, 2012 at 4:20

Would adding an import at the top help in showing what lib/class you are using?

import com.google.common.collect.Lists;

List<String> items = Lists.newArrayList();
  • 2
    According to the OP he technical interviewer didn't know Google Guava, so most likely the import won't ring a bell.
    – THelper
    Oct 15, 2012 at 7:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.