| 250 | |
| 251 | |
| 252 | extend Stack<of T> |
| 253 | |
| 254 | def clone as Stack<of T> |
| 255 | ensure |
| 256 | result is not this |
| 257 | result.count == .count |
| 258 | result.typeOf is .typeOf |
| 259 | |
| 260 | |
| 261 | extend IDictionary<of TKey, TValue> |
| 262 | |
| 263 | def clone as IDictionary<of TKey, TValue> # CC: as same |
| 264 | """ |
| 265 | Returns a new dictionary with the contents of this dictionary. |
| 266 | Does not clone the contents themselves. |
| 267 | This is sometimes known as a "shallow copy". |
| 268 | """ |
| 269 | ensure |
| 270 | result is not this |
| 271 | result.count == .count |
| 272 | result.typeOf is .typeOf |
| 273 | |
| 274 | def get(key as TKey, default as TValue) as TValue |
| 275 | """ |
| 276 | Returns the value for the given key, or returns the default if the key is not found. |
| 277 | """ |
| 278 | ensure not .containsKey(key) implies result == default |