-
Notifications
You must be signed in to change notification settings - Fork 0
Map
Dickson Law edited this page Apr 12, 2023
·
4 revisions
A data structure that stores string-value pairs. Equivalent to DS Maps.
An iterator class designed to efficiently loop through the map in linear time. It stores its current key in key and current value in value.
-
hasNext(): Return whether there are more values to iterate. -
next(): Iterate to the next value. -
remove(): Remove the current value from the map. -
set(val): Set the current value in the map to the given value.
A for loop using MapIterator takes this form:
for (var i = map.iterator(); i.hasNext(); i.next()) {
/* Use i.key and i.value here */
}
-
add(key, val): Seeds_map_add(id, key, val). -
clear(): Seeds_map_clear(id). -
copy(sourceMap): Seeds_map_copy(id, source). -
empty(): Seeds_map_empty(id). -
exists(key): Seeds_map_exists(id, key). -
findFirst(): Seeds_map_find_first(id). -
findLast(): Seeds_map_find_last(id). -
findNext(key): Seeds_map_find_next(id, key). -
findPrevious(key): Seeds_map_find_previous(id, key). -
findValue(key): Seeds_map_find_value(id, key). -
read(datastr): Seeds_map_read(id, str). -
remove(key): Seeds_map_delete(id, key). -
replace(key, val): Seeds_map_replace(id, key, val). -
set(key, val): Seeds_map_set(id, key, val). -
size(): Seeds_map_size(id). -
write(): Seeds_map_write(id).
-
get(key): Same asfindValue(key).
-
clone(): Return a shallow clone of the map. -
cloneDeep(): Same asclone(), but also making deep copies of everything in the map. -
copyDeep(sourceMap): Same ascopy(sourceMap), but with deep copies of everything in the source. -
forEach(func): Call the method or scriptfuncfor each value in the map. On each iteration, it will be passed the current value followed by the current key. -
iterator(): Return a newMapIteratorset to track this map. -
keys(): Return an array of all key strings in the map. -
mapEach(func): Set each valuevin the map tofunc(v). Iffuncthrowsundefined, the value is removed from the map.