注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
就45min, 老殷,说只招一个岗
1. 问了问项目,他语言表达能力是真模糊啊,自己问问题不清楚,然后也感觉对我没啥兴趣
个值和新加一个obj,print什么
- import java.util.HashMap;
- import java.util.Map;
- public class SessionCache {
- static boolean stopped;
- static class Key {
- Integer id;
- Key(Integer id) { this.id = id; }
- @Override public int hashCode() { return id.hashCode(); }
- }
- public static void main(String[] args) {
- Map<Key, String> cache = new HashMap<>();
- new Thread(() -> {
- try {
- Thread.sleep(24 * 60 * 60 * 1000);
- stopped = true;
- } catch (Exception e) {
- } finally {
- stopped = true;
- }
- }).start();;
- int i = 1;
- while (!stopped) {
- cache.put(new Key(i % 5000), "DATA" + i);
- i++;
- }
- }
- // max / min value of key.id
- // num elements in the cache
- // how ling this program runs
- }
复制代码 |