Package com.jk.core.collections
Interface JKMap<K,V>
- Type Parameters:
K
- Specifies the type of the keys inside the map.V
- Specifies the type of values inside the map.
- All Known Implementing Classes:
JKGuavaCacheWrapper
,JKMapWrapper
public interface JKMap<K,V>
This interface is a generic interface that represents a map.
Implementation of this interface provides methods for managing and accessing items contained within the map.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
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.
-
Method Details
-
put
This method associates the specified value with the specified key in this map.- Parameters:
k
- Specifies the key with which the specified value is to be associated.v
- Specifies the value to be associated with the specified key.
-
get
This method gets the value to which the specified key is mapped in this map.- Parameters:
k
- Specifies the key with which the value is associated with.- Returns:
- the value that is associated with the specified key.
-
clear
void clear()This method clears all the map entries. -
keySet
This method returns the keys set of this map.- Returns:
- a set of the keys in this map.
-
containsKey
This method checks whether this map contains the specified key or not.- 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.
- Parameters:
key
- Specifies the key which the entry is associated with.- Returns:
- the associated value in the entry that was removed.
-
asMap
This method returns the currentJKMap
entries as aMap
.- Returns:
- a
Map
containing all the entries inside theJKMap
-