michael@0: // A map iterator can cope with removing the next entry. michael@0: michael@0: load(libdir + "iteration.js"); michael@0: michael@0: var set = Set("abcd"); michael@0: var iter = set[std_iterator](); michael@0: var log = ""; michael@0: for (let x of iter) { michael@0: log += x; michael@0: if (x === "b") michael@0: set.delete("c"); michael@0: } michael@0: assertEq(log, "abd");