Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently I participated in an interview for a Russian company in Moskow and could not answer some of the simple questions. One of them I would like to ask here.

List all problems which you can see in the following code:

public abstract class Digest {
  private Map<byte[], byte[]> cache = new HashMap<byte[], byte[]>();

  public byte[] digest(byte[] input) {
      byte[] result = cache.get(input);
      if (result == null) {
          synchronized (cache) {
              result = cache.get(input);
              if (result == null) {
                  result = doDigest(input);
                  cache.put(input, result);
      return result;

  protected abstract byte[] doDigest(byte[] input);
share|improve this question

closed as off topic by codesparkle, Trevor Pilley, Jeff Vanzella, Brian Reichle, sepp2k Nov 15 '12 at 10:20

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 1 down vote accepted

Try this link

It seems it may be a standard interview question as interviewees have previously posted it on Stack Overflow. Or maybe interviewers are getting lazy and have started lifting their questions directly from Stack Overflow in the first place?

share|improve this answer
The latter wouldn't surprise me at all. – Bobson Nov 14 '12 at 16:24
Thanks a lot for the link – maxormo Nov 15 '12 at 6:57
Why would you link to an unofficial mirror instead of the actual stackoverflow? Seems like a very odd choice. – Corbin Dec 1 '12 at 9:38
Because as far as I can tell the question has been deleted from the Stack Overflow site and so I have no option but to link to the unofficial mirror. – DMK Dec 1 '12 at 18:16

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