Iterator.set

Sets a value to an element the iterator points to.

Arguments

The

value
to set.

Return values

None

Complexity

Constant

Example

"sl/array" useFile "sl/linkedList" useFile "sl/hashTable" useFile "sl/redBlackTree" useFile a: (1 2 3) makeArray; l: (4 5 6) makeList; ht: ((1 "ONE") (2 "TWO") (3 "THREE")) makeHashTable; rb: ((4 "FOUR") (5 "FIVE") (6 "SIX")) makeRedBlackTree; 10 a.firstIter.set "Array:" print LF print a [print LF print TRUE] enum 10 l.firstIter.set "LinkedList:" print LF print l [print LF print TRUE] enum 10 ht.firstIter.set "HashTable:" print LF print ht [print LF print TRUE] enum 10 rb.firstIter.set "RedBlackTree:" print LF print rb [print LF print TRUE] enum
Output:
Array: 10 2 3 LinkedList: 10 5 6 HashTable: { key: 1; value: 10; } { key: 2; value: "TWO"; } { key: 3; value: "THREE"; } RedBladckTree: { key: 4; value: 10; } { key: 5; value: "FIVE"; } { key: 6; value: "SIX"; }