@NotThreadSafe public class

MemoizingMap

extends AbstractMap<K, V>
implements Map<K, V>
java.lang.Object
   ↳ java.util.AbstractMap<K, V>
     ↳ com.atlassian.jira.util.collect.MemoizingMap<K, V>

Class Overview

A Map that is backed by a MemoizingMap.Master map that contains suppliers for the values that are called lazily when required. This can reduce the amount of memory required if there are a number of entries that may or may not be required in the most case.

For example, when rendering Velocity templates, the context map is populated with a lot of things that are only ever required occasionally.

Note: even though this class is effectively immutable and does not support direct mutation, the memoization strategy is not thread-safe and should not be used if thread-safety is required. Adding thread-safety to this class would be fairly trivial through.

Summary

Nested Classes
class MemoizingMap.Master<K, V> Master that individual Maps can be printed from. 
Public Methods
boolean containsKey(Object key)
Set<Entry<K, V>> entrySet()
V get(Object key)
.
boolean isEmpty()
Set<K> keySet()
V remove(Object key)
int size()
[Expand]
Inherited Methods
From class java.util.AbstractMap
From class java.lang.Object
From interface java.util.Map

Public Methods

public boolean containsKey (Object key)

public Set<Entry<K, V>> entrySet ()

public V get (Object key)

.

Implements the local caching of a value from the master.

public boolean isEmpty ()

public Set<K> keySet ()

public V remove (Object key)

public int size ()