Created
November 11, 2013 14:24
-
-
Save marinat/7413882 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Generator { | |
private static final Map<byte[], byte[]> cache = new HashMap<byte[], byte[]>(); | |
public static byte[] generate(byte[] src) { | |
byte[] generated = cache.get(src); | |
if (generated == null) { | |
synchronized (cache) { | |
generated = cache.get(src); | |
if (generated == null) { | |
generated = doGenerate(src); | |
cache.put(src, generated); | |
} | |
} | |
} | |
return generated; | |
} | |
private static byte[] doGenerate(byte[] src) {...} | |
// ... | |
} | |
Подробнее: http%3A%2F%2Fcompany.yandex.ru%2Fjob%2Fvacancies%2Fandroidspb.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
не используй byte[] как ключ в HashMap