模拟访问某个值 @param object
(T object)
| 38 | * @param object |
| 39 | */ |
| 40 | public void offer(T object) { |
| 41 | if (object == null) { |
| 42 | throw new IllegalArgumentException("该缓存容器不支持null!"); |
| 43 | } |
| 44 | Integer index = holder.get(object); |
| 45 | if (index == null) { |
| 46 | if (isFull()) { |
| 47 | removeAndCache(object); |
| 48 | } else { |
| 49 | cache(object, count); |
| 50 | } |
| 51 | } else { |
| 52 | update(index); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * 若缓存中有指定的值,则更新位置 |
no test coverage detected