Package com.jk.core.collections.map
Class JKGuavaCacheWrapper<K,V>
java.lang.Object
com.jk.core.collections.map.JKGuavaCacheWrapper<K,V>
- Type Parameters:
K
- Specifies the type of the key associated with the cache value.V
- Specifies the cache value type that is associated with the key.
- All Implemented Interfaces:
JKMap<K,
V>
This class represents a wrapper class that stores cache entries and provides
the necessary method to interact with and access the cache stored within.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
ConstructorsConstructorDescriptionJKGuavaCacheWrapper
(com.google.common.cache.Cache<K, V> cache) This method constructs a new instance of theJKGuavaCacheWrapper
with the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionasMap()
This method returns the currentJKMap
entries as aMap
.void
clear()
This method clears all the map entries.boolean
containsKey
(K key) This method checks whether this map contains the specified key or not.This method gets the value to which the specified key is mapped in this map.keySet()
This method returns the keys set of this map.void
This method associates the specified value with the specified key in this map.This method removes the entry that is associated with the specified key, and return the value of the removed entry.toString()
Returns a string representation of the object.
-
Constructor Details
-
JKGuavaCacheWrapper
This method constructs a new instance of theJKGuavaCacheWrapper
with the provided parameters.This constructor initializes the object with the specified values for its attributes.
- Parameters:
cache
- Specifies the stored cache entries.
-
-
Method Details
-
put
This method associates the specified value with the specified key in this map. -
get
This method gets the value to which the specified key is mapped in this map. -
clear
public void clear()This method clears all the map entries. -
keySet
This method returns the keys set of this map. -
containsKey
This method checks whether this map contains the specified key or not.- Specified by:
containsKey
in interfaceJKMap<K,
V> - Parameters:
key
- Specifies the key to be searched for in this map.- Returns:
- true, if this map contains the specified key, false, otherwise.
-
remove
This method removes the entry that is associated with the specified key, and return the value of the removed entry.The map will not contain a mapping for the specified key once the call returns.
-
toString
Returns a string representation of the object. -
asMap
This method returns the currentJKMap
entries as aMap
.
-