类 MapCache<Key,Value,Param>

java.lang.Object
cn.taketoday.util.MapCache<Key,Value,Param>
类型参数:
Key - key type
Param - param type, extra computing param type
Value - value type

public class MapCache<Key,Value,Param> extends Object
Map cache
从以下版本开始:
3.0
作者:
TODAY 2021/1/27 23:02
  • 字段详细资料

  • 构造器详细资料

    • MapCache

      public MapCache()
    • MapCache

      public MapCache(int initialCapacity)
    • MapCache

      public MapCache(Map<Key,Value> mapping)
      参数:
      mapping - allows to define your own map implementation
    • MapCache

      public MapCache(Function<Key,Value> mappingFunction)
    • MapCache

      public MapCache(Map<Key,Value> mapping, @Nullable Function<Key,Value> mappingFunction)
      参数:
      mapping - allows to define your own map implementation
  • 方法详细资料

    • get

      public final Value get(Key key, Param param)
      If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.

      High performance way

      参数:
      key - key with which the specified value is to be associated
      param - createValue's param
      返回:
      the current (existing or computed) value associated with the specified key, or null if the computed value is null
      另请参阅:
    • get

      public final Value get(Key key)
      If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.
      参数:
      key - key with which the specified value is to be associated
      返回:
      the current (existing or computed) value associated with the specified key, or null if the computed value is null
    • get

      public final Value get(Key key, @Nullable Function<Key,Value> mappingFunction)
      If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.
      参数:
      key - key with which the specified value is to be associated
      mappingFunction - the function to compute a value, can be null, if its null use default mappingFunction
      返回:
      the current (existing or computed) value associated with the specified key, or null if the computed value is null
    • createValue

      protected Value createValue(Key key, Param param)
    • put

      public Value put(Key key, Value value)
    • clear

      public void clear()
    • remove

      public Value remove(Key key)