Package co.aikar.util

# Class MRUMapCache<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
co.aikar.util.MRUMapCache<K,V>

Type Parameters:
  `K` - Key Type of the Map
  `V` - Value Type of the Map

All Implemented Interfaces:
  `Map<K,V>`

public class MRUMapCache<K,V> extends AbstractMap<K,V>
Implements a Most Recently Used cache in front of a backing map, to quickly access the last accessed result.

## Nested Class Summary

## Nested classes/interfaces inherited from class java.util.AbstractMap

`AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>`

## Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K extends Object,V extends Object>`

## Constructor Summary

Constructors
Constructor
Description
`MRUMapCache(@NotNull Map<K,V> backingMap)`

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
`boolean`
`containsKey(@Nullable Object key)`
`boolean`
`containsValue(@Nullable Object value)`
`@NotNull Set<Map.Entry<K,V>>`
`entrySet()`
`V`
`get(@Nullable Object key)`
`boolean`
`isEmpty()`
`@NotNull Set<K>`
`keySet()`
`static <K, V> @NotNull Map<K,V>`
`of(@NotNull Map<K,V> map)`
Wraps the specified map with a most recently used cache
`V`
`put(K key, V value)`
`void`
`putAll(@NotNull Map<? extends K,? extends V> m)`
`V`
`remove(@Nullable Object key)`
`int`
`size()`
`@NotNull Collection<V>`
`values()`

### Methods inherited from class java.util.AbstractMap

`clone, equals, hashCode, toString`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Map

`compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

## Constructor Details

### MRUMapCache

public MRUMapCache(@NotNull @NotNull Map<K,V> backingMap)

## Method Details

### size

public int size()

Specified by:
  `size` in interface `Map<K,V>`
Overrides:
  `size` in class `AbstractMap<K,V>`

### isEmpty

public boolean isEmpty()

Specified by:
  `isEmpty` in interface `Map<K,V>`
Overrides:
  `isEmpty` in class `AbstractMap<K,V>`

### containsKey

public boolean containsKey(@Nullable @Nullable Object key)

Specified by:
  `containsKey` in interface `Map<K,V>`
Overrides:
  `containsKey` in class `AbstractMap<K,V>`

### containsValue

public boolean containsValue(@Nullable @Nullable Object value)

Specified by:
  `containsValue` in interface `Map<K,V>`
Overrides:
  `containsValue` in class `AbstractMap<K,V>`

### get

@Nullable public V get(@Nullable @Nullable Object key)

Specified by:
  `get` in interface `Map<K,V>`
Overrides:
  `get` in class `AbstractMap<K,V>`

### put

@Nullable public V put(@Nullable K key, @Nullable V value)

Specified by:
  `put` in interface `Map<K,V>`
Overrides:
  `put` in class `AbstractMap<K,V>`

### remove

@Nullable public V remove(@Nullable @Nullable Object key)

Specified by:
  `remove` in interface `Map<K,V>`
Overrides:
  `remove` in class `AbstractMap<K,V>`

### putAll

public void putAll(@NotNull @NotNull Map<? extends K,? extends V> m)

Specified by:
  `putAll` in interface `Map<K,V>`
Overrides:
  `putAll` in class `AbstractMap<K,V>`

### clear

public void clear()

Specified by:
  `clear` in interface `Map<K,V>`
Overrides:
  `clear` in class `AbstractMap<K,V>`

### keySet

@NotNull public @NotNull Set<K> keySet()

Specified by:
  `keySet` in interface `Map<K,V>`
Overrides:
  `keySet` in class `AbstractMap<K,V>`

### values

@NotNull public @NotNull Collection<V> values()

Specified by:
  `values` in interface `Map<K,V>`
Overrides:
  `values` in class `AbstractMap<K,V>`

### entrySet

@NotNull public @NotNull Set<Map.Entry<K,V>> entrySet()

Specified by:
  `entrySet` in interface `Map<K,V>`
Specified by:
  `entrySet` in class `AbstractMap<K,V>`

### of

@NotNull public static <K, V> @NotNull Map<K,V> of(@NotNull @NotNull Map<K,V> map)
Wraps the specified map with a most recently used cache

Type Parameters:
  `K` - Key Type of the Map
  `V` - Value Type of the Map
Parameters:
  `map` - Map to be wrapped
Returns:
  Map