You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in smart contract,in fact,there are no methods to get the size of map,take visit to a map and delete some elements in a map.so I wish something better can occur to solve these problems.
The text was updated successfully, but these errors were encountered:
add a counter k-counter,initial k-counter = 0
use two maps indexMap and dataMap,as you want to use set/put method to storage the k-v,you can do like this:first indexMap.put(k-counter,key);k-counter += 1; then dataMap.put(key,value);
after you use this way to storage the k-v,you can easily get the size of the map,that is the k-counter,and use : for(var i=0;i<k-counter;i++){
var k = indexMap.get(i);
var data = dataMap.get(k);
}
to iterate the map.Also,you can use this way to clear the map
in smart contract,in fact,there are no methods to get the size of map,take visit to a map and delete some elements in a map.so I wish something better can occur to solve these problems.
The text was updated successfully, but these errors were encountered: