(int key)
| 44 | |
| 45 | |
| 46 | @Override |
| 47 | public V get(int key) { |
| 48 | V res = super.get(key); |
| 49 | if (res == null) { |
| 50 | res = loader.apply(key); |
| 51 | if (res != null) { |
| 52 | put(key, res); |
| 53 | } |
| 54 | } |
| 55 | return res; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Due to java stuff, you will need to cast it to (Function) for some cases |