Entity
This class uses Map
to store data in key-value pairs. It keeps track of the number of data and selected data.
Properties
Properties
data Map
A Map() object that stores the data.
selectedData string
The selected data is actually the key of the data selected.
count string
Keeps track of the number of key-value pairs.
Methods
addData(key, value) boolean
Add the given key-value pair into the data
variable and selectedData
is assign to the newly created key.
isData(key) boolean
Check if a value is mapped to a given key in the data
deleteData(key) boolean
Deletes the key-value pair from the data
of the given key
clearData(key) void
Deletes all the key-value pairs in the data
.
selectData(key) boolean
Assigns the selectedData
to the given key
getData(key) object
Returns the value for the given key. Returns null if a value does not exist for the given key.
getAllData(key) object
Returns the data
.