operator [] method

V? operator [](
  1. K key
)

Implementation

V? operator [](K key) {
  if (!_cache.containsKey(key)) return null;

  // 如果访问了某个key,将其移动到链表的末尾(表示最近使用)
  final value = _cache.remove(key);
  _cache[key] = value as V;
  return value;
}